コード例 #1
0
class _SmokeDebugVisualization(object):
    def __init__(self, position, equipmentID, endTime):
        smokeScreenEquipment = vehicles.g_cache.equipments()[equipmentID]
        self._startRadius = smokeScreenEquipment.startRadius
        self._startHeight = smokeScreenEquipment.startHeight
        self._expansionDuration = smokeScreenEquipment.expansionDuration
        self._expandedRadius = smokeScreenEquipment.expandedRadius
        self._expandedHeight = smokeScreenEquipment.expandedHeight
        self._heightUpFraction = smokeScreenEquipment.heightUpFraction
        self._totalDuration = smokeScreenEquipment.totalDuration
        self.__position = position
        self.__callbackID = None
        self.__endTime = endTime
        self.__debugGizmo = DebugGizmo(
            'objects/misc/bbox/cylinder1_proxy.model')
        self.__startTime = BigWorld.serverTime()
        self.__currentMatrix = Math.Matrix()
        self.__onUpdate()
        return

    def stop(self):
        self.__debugGizmo = None
        return

    def __onUpdate(self):
        if not self.__debugGizmo:
            return
        curTime = BigWorld.serverTime()
        deltaTime = curTime - self.__startTime
        if deltaTime > self._totalDuration:
            return
        expansionRate = (self._expandedRadius -
                         self._startRadius) / self._expansionDuration
        heightExpansionRate = (self._expandedHeight -
                               self._startHeight) / self._expansionDuration
        radius = min(self._startRadius + deltaTime * expansionRate,
                     self._expandedRadius)
        height = min(self._startHeight + deltaTime * heightExpansionRate,
                     self._expandedHeight)
        self.__currentMatrix = self.__mkMatrix(radius, height)
        self.__debugGizmo.setMatrix(self.__currentMatrix)
        if radius <= self._expandedRadius:
            BigWorld.callback(1, self.__onUpdate)

    def __mkMatrix(self, radius, height):
        matrix = Math.Matrix()
        matrix.setRotateYPR((0, 0, 0))
        matrix.translation = self.__position + Math.Vector3(
            0, -height * (1 - self._heightUpFraction), 0)
        scaleMatrix = Math.Matrix()
        scaleMatrix.setScale((radius, height, radius))
        matrix.preMultiply(scaleMatrix)
        return matrix
コード例 #2
0
 def __init__(self, position, equipmentID, endTime):
     smokeScreenEquipment = vehicles.g_cache.equipments()[equipmentID]
     self._startRadius = smokeScreenEquipment.startRadius
     self._startHeight = smokeScreenEquipment.startHeight
     self._expansionDuration = smokeScreenEquipment.expansionDuration
     self._expandedRadius = smokeScreenEquipment.expandedRadius
     self._expandedHeight = smokeScreenEquipment.expandedHeight
     self._heightUpFraction = smokeScreenEquipment.heightUpFraction
     self._totalDuration = smokeScreenEquipment.totalDuration
     self.__position = position
     self.__callbackID = None
     self.__endTime = endTime
     self.__debugGizmo = DebugGizmo(
         'objects/misc/bbox/cylinder1_proxy.model')
     self.__startTime = BigWorld.serverTime()
     self.__currentMatrix = Math.Matrix()
     self.__onUpdate()
     return
コード例 #3
0
ファイル: Vehicle.py プロジェクト: kusaku/wot_scripts
 def __debugDrawCollisionMatrices(self):
     if not constants.IS_DEVELOPMENT:
         return
     from Flock import DebugGizmo
     if not hasattr(self, '_Vehicle__debugDrawData'):
         self.__debugDrawData = {}
     components = self.getComponents()
     for index, (_, compMatrix, _) in enumerate(components):
         compMatrix.invert()
         compMatrix.postMultiply(Math.Matrix(self.model.matrix))
         if not self.__debugDrawData.has_key(index):
             self.__debugDrawData[index] = DebugGizmo()
         gizmo = self.__debugDrawData[index]
         gizmo.motor.signal = compMatrix