def set(self, start, end): self.start = start self.end = end direction = end - start m = mathUtils.createSRTMatrix((self.__thickness, self.__thickness, direction.length), (direction.yaw, direction.pitch, 0), start + direction / 2) m.preMultiply(mathUtils.createTranslationMatrix(Vector3(-0.5, -0.5, -0.5))) self.motor.signal = m
def __setupModel(self, buildIdx): model = self.__assembleModel() matrix = mathUtils.createSRTMatrix(Math.Vector3(_CFG['v_scale'], _CFG['v_scale'], _CFG['v_scale']), _CFG['v_start_angles'], _CFG['v_start_pos']) model.matrix = matrix self.__doFinalSetup(buildIdx, model) entity = BigWorld.entity(self.__vEntityId) if isinstance(entity, HangarVehicle): entity.typeDescriptor = self.__vDesc
def __createCube(self, position, size): modelName = self.CUBE_MODEL model, motor = self.__getModel(modelName) m = mathUtils.createSRTMatrix(size, (0, 0, 0), position) m.preMultiply( mathUtils.createTranslationMatrix(Vector3(0.0, -0.5, 0.0))) motor.signal = m return (modelName, model, motor)
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 = mathUtils.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)
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 = mathUtils.createSRTMatrix((areaWidth, 5, 1), (0.0, 0, 0), Vector3(0, 0, 0)) linearHomer.acceleration = 0 linearHomer.velocity = velocity linearHomer.target = mathUtils.createTranslationMatrix(endExplosionPos) linearHomer.proximityCallback = self.__onDeath
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 = mathUtils.createSRTMatrix((areaWidth, 5, 1), (0.0, 0, 0), Vector3(0, 0, 0)) linearHomer.acceleration = 0 linearHomer.velocity = velocity linearHomer.target = mathUtils.createTranslationMatrix(endExplosionPos) linearHomer.proximityCallback = self.__onDeath
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 = mathUtils.createSRTMatrix(scale, rotation, translation) m.preMultiply( mathUtils.createTranslationMatrix(Vector3(0.0, -0.5, 0.0))) motor.signal = m return (modelName, model, motor)
def __setupModel(self, buildIdx): self.__assembleModel() cfg = hangarCFG() matrix = mathUtils.createSRTMatrix(Math.Vector3(cfg['v_scale'], cfg['v_scale'], cfg['v_scale']), 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 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)) gunLink = mathUtils.MatrixProviders.product(gunoffset, self.__vEntity.model.node(TankPartNames.GUN)) 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), self.__vEntity.model.node(TankPartNames.GUN))) 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, ColliderTypes.HANGAR_VEHICLE_COLLIDER, collisionData) self.__reloadColliderType(self.__vEntity.state) self.__reloadShadowManagerTarget(self.__vEntity.state)
def __createSphere(self, position, radius): modelName = self.SPHERE_MODEL model, motor = self.__getModel(modelName) motor.signal = mathUtils.createSRTMatrix(radius, (0, 0, 0), position) return (modelName, model, motor)