コード例 #1
0
 def __setupModel(self, buildIdx):
     self.__assembleModel()
     matrix = math_utils.createSRTMatrix(Math.Vector3(1.0, 1.0, 1.0), Math.Vector3(self.__vEntity.yaw, self.__vEntity.pitch, self.__vEntity.roll), self.__vEntity.position)
     self.__vEntity.model.matrix = matrix
     self.__doFinalSetup(buildIdx)
     self.__vEntity.typeDescriptor = self.__vDesc
     typeDescr = self.__vDesc
     wheelConfig = typeDescr.chassis.generalWheelsAnimatorConfig
     if self.wheelsAnimator is not None and wheelConfig is not None:
         self.wheelsAnimator.createCollision(wheelConfig, self.collisions)
     gunColBox = self.collisions.getBoundingBox(TankPartNames.getIdx(TankPartNames.GUN) + 3)
     center = 0.5 * (gunColBox[1] - gunColBox[0])
     gunoffset = Math.Matrix()
     gunoffset.setTranslate((0.0, 0.0, center.z + gunColBox[0].z))
     gunNode = self.__getGunNode()
     gunLink = math_utils.MatrixProviders.product(gunoffset, gunNode)
     collisionData = ((TankPartNames.getIdx(TankPartNames.CHASSIS), self.__vEntity.model.matrix),
      (TankPartNames.getIdx(TankPartNames.HULL), self.__vEntity.model.node(TankPartNames.HULL)),
      (TankPartNames.getIdx(TankPartNames.TURRET), self.__vEntity.model.node(TankPartNames.TURRET)),
      (TankPartNames.getIdx(TankPartNames.GUN), gunNode))
     self.collisions.connect(self.__vEntity.id, ColliderTypes.VEHICLE_COLLIDER, collisionData)
     collisionData = ((TankPartNames.getIdx(TankPartNames.GUN) + 1, self.__vEntity.model.node(TankPartNames.HULL)), (TankPartNames.getIdx(TankPartNames.GUN) + 2, self.__vEntity.model.node(TankPartNames.TURRET)), (TankPartNames.getIdx(TankPartNames.GUN) + 3, gunLink))
     self.collisions.connect(self.__vEntity.id, self._getColliderType(), collisionData)
     self._reloadColliderType(self.__vEntity.state)
     self.__reloadShadowManagerTarget(self.__vEntity.state)
     return
コード例 #2
0
 def __createCube(self, position, size):
     modelName = self.CUBE_MODEL
     model, motor = self.__getModel(modelName)
     m = math_utils.createSRTMatrix(size, (0, 0, 0), position)
     m.preMultiply(
         math_utils.createTranslationMatrix(Vector3(0.0, -0.5, 0.0)))
     motor.signal = m
     return (modelName, model, motor)
コード例 #3
0
 def set(self, start, end):
     self.start = start
     self.end = end
     direction = end - start
     m = math_utils.createSRTMatrix(
         (self.__thickness, self.__thickness, direction.length),
         (direction.yaw, direction.pitch, 0), start + direction)
     m.preMultiply(
         math_utils.createTranslationMatrix(Vector3(0.0, 0.0, -0.5)))
     self.motor.signal = m
コード例 #4
0
 def __init__(self, beginExplosionPos, endExplosionPos, areaWidth, velocity):
     CallbackDelayer.__init__(self)
     self.model = BigWorld.Model('helpers/models/unit_cube.model')
     BigWorld.addModel(self.model)
     self.model.position = beginExplosionPos
     linearHomer = BigWorld.LinearHomer()
     self.model.addMotor(linearHomer)
     linearHomer.align = math_utils.createSRTMatrix((areaWidth, 5, 1), (0.0, 0, 0), Vector3(0, 0, 0))
     linearHomer.acceleration = 0
     linearHomer.velocity = velocity
     linearHomer.target = math_utils.createTranslationMatrix(endExplosionPos)
     linearHomer.proximityCallback = self.__onDeath
コード例 #5
0
 def __areaGameObjectLoaded(self, gameObject):
     if self.isDestroyed:
         return
     self.__areaGO = gameObject
     t = gameObject.findComponentByType(
         GenericComponents.TransformComponent)
     floatEpsilon = 0.001
     xScale = self._equipment.areaWidth * 0.5
     zScale = self._equipment.areaLength * 0.5
     t.transform = math_utils.createSRTMatrix(
         Math.Vector3(xScale, 1.0, zScale), (0.0, 0.0, 0.0),
         (0.0, floatEpsilon, 0.0))
コード例 #6
0
 def __createDirectedLine(self, pointA, pointB, width):
     modelName = self.CUBE_MODEL
     model, motor = self.__getModel(modelName)
     direction = pointB - pointA
     scale = (width, width, direction.length)
     rotation = (direction.yaw, direction.pitch, 0)
     translation = pointA + direction * 0.5
     m = math_utils.createSRTMatrix(scale, rotation, translation)
     m.preMultiply(
         math_utils.createTranslationMatrix(Vector3(0.0, -0.5, 0.0)))
     motor.signal = m
     return (modelName, model, motor)
コード例 #7
0
 def createTerrainEffect(self,
                         position,
                         scale=None,
                         loopCount=1,
                         rotation=(0, 0, 0)):
     if self.__sequenceAnimator is not None and not self.__sequenceAnimator.isBound(
     ):
         scale = scale if scale is not None else Math.Vector3(1, 1, 1)
         matrix = math_utils.createSRTMatrix(scale, rotation, position)
         self.__sequenceAnimator.bindToWorld(matrix)
         self.__sequenceAnimator.loopCount = loopCount
         self.__sequenceAnimator.start()
         return True
     else:
         return False
コード例 #8
0
 def __init__(self):
     BigWorld.UserDataObject.__init__(self)
     self.__gameObject = CGF.GameObject(BigWorld.player().spaceID, 'SoundZoneTrigger')
     self.__gameObject.setStatic(True)
     position = math_utils.createRTMatrix(Math.Vector3(self.direction.z, self.direction.y, self.direction.x), self.position)
     self.__gameObject.createComponent(TransformComponent, position)
     self.__gameObject.createComponent(SoundZoneComponent, self.ZoneEnter, self.ZoneExit, self.Reverb, '', self.ReverbLevel, self.VolumeDeviation)
     v = Math.Vector3(self.Size.x, self.Size.y, self.Size.z) * 0.5
     self.__gameObject.createComponent(SquareAreaComponent, -v, v)
     self.__gameObject.activate()
     if VISUALISE_ZONE:
         self.model = BigWorld.Model('objects/misc/bbox/unit_cube_1m_proxy.model')
         BigWorld.player().addModel(self.model)
         motor = BigWorld.Servo(Math.Matrix())
         self.model.addMotor(motor)
         motor.signal = math_utils.createSRTMatrix(Math.Vector3(self.Size.x, self.Size.y, self.Size.z), Math.Vector3(self.direction.z, self.direction.y, self.direction.x), self.position)
コード例 #9
0
 def __init__(self):
     BigWorld.UserDataObject.__init__(self)
     BigWorld.addSoundZoneTrigger(
         self.position,
         Math.Vector3(self.direction.z, self.direction.y, self.direction.x),
         Math.Vector3(self.Size.x, self.Size.y,
                      self.Size.z), self.ZoneEnter, self.ZoneExit,
         self.Reverb, self.ReverbLevel, self.VolumeDeviation)
     if VISUALISE_ZONE:
         self.model = BigWorld.Model(
             'objects/misc/bbox/unit_cube_1m_proxy.model')
         BigWorld.player().addModel(self.model)
         motor = BigWorld.Servo(Math.Matrix())
         self.model.addMotor(motor)
         motor.signal = math_utils.createSRTMatrix(
             Math.Vector3(self.Size.x, self.Size.y, self.Size.z),
             Math.Vector3(self.direction.z, self.direction.y,
                          self.direction.x), self.position)
コード例 #10
0
 def __getTransform(self, vehicle):
     predefinedTransform = _TransformationParser.getTransform(
         vehicle.typeDescriptor.name.split(':')[1],
         TankPartIndexes.getName(self._TANK_PART_INDEX),
         self._getModuleName(vehicle.typeDescriptor))
     translation = predefinedTransform.get(
         'offset') if predefinedTransform is not None else None
     scale = predefinedTransform.get(
         'scale') if predefinedTransform is not None else None
     if translation is None or scale is None:
         minBounds, maxBounds, _ = vehicle.appearance.collisions.getBoundingBox(
             self._TANK_PART_INDEX)
         translation = translation or Math.Vector3(
             (minBounds[0] + maxBounds[0]) / 2.0,
             (minBounds[1] + maxBounds[1]) / 2.0,
             (minBounds[2] + maxBounds[2]) / 2.0)
         scale = scale or Math.Vector3(abs(minBounds[0] - maxBounds[0]),
                                       abs(minBounds[1] - maxBounds[1]),
                                       abs(minBounds[2] - maxBounds[2]))
     rotation = Math.Vector3(0.0, 0.0, 0.0)
     return math_utils.createSRTMatrix(scale, rotation, translation)
コード例 #11
0
 def __createSphere(self, position, radius):
     modelName = self.SPHERE_MODEL
     model, motor = self.__getModel(modelName)
     motor.signal = math_utils.createSRTMatrix(radius, (0, 0, 0), position)
     return (modelName, model, motor)