def _makeSPGProvider(): dataProvider = GUI.WGSPGGunMarkerDataProvider(aih_constants.SPG_GUN_MARKER_ELEMENTS_COUNT, aih_constants.SPG_GUN_MARKER_ELEMENTS_RATE) dataProvider.positionMatrixProvider = Math.MatrixAnimation() dataProvider.maxTime = 7.0 dataProvider.serverTickLength = constants.SERVER_TICK_LENGTH dataProvider.sizeScaleRate = aih_constants.SPG_GUN_MARKER_SCALE_RATE dataProvider.sizeConstraint = (aih_constants.SPG_GUN_MARKER_MIN_SIZE, aih_constants.SPG_GUN_MARKER_MAX_SIZE) dataProvider.setRelaxTime(constants.SERVER_TICK_LENGTH) return dataProvider
def floatAway(self, entity): entity.model.root.detach(self.dummy) initial = Math.Matrix(entity.model.root) final = Math.Matrix() final.setTranslate((0, -5, 0)) final.preMultiply(initial) ma = Math.MatrixAnimation() ma.keyframes = [(0.0, initial), (5.0, final)] ma.loop = False ma.time = 0.0 motor = BigWorld.Servo(ma) self.dummy.addMotor(motor) BigWorld.addModel(self.dummy) BigWorld.callback(5.0, partial(BigWorld.delModel, self.dummy))
def setupTank(chassisFashion, gunFashion, vehicleDesc, worldMatrix, resources): print resources tank = resources[vehicleDesc.name] tank.matrix = worldMatrix tanks.append(tank) effect = Pixie.create('particles/Tank/exhaust/large_gas_gear.xml') tank.node('HP_gunFire').attach(effect) tank.node('HP_gunFire').attach( BigWorld.Model('helpers/models/position_gizmo.model')) tank.node('HP_Track_Exhaus_1').attach( BigWorld.Model('helpers/models/unit_cube.model')) m = mathUtils.createTranslationMatrix(Vector3(0, 10, 5)) fakeMatrixes.append(m) tank.node('gun').attach(effect.clone(), m) BigWorld.addModel(tank) recoilDescr = vehicleDesc.gun['recoil'] recoil = BigWorld.RecoilAnimator(recoilDescr['backoffTime'], recoilDescr['returnTime'], recoilDescr['amplitude'], recoilDescr['lodDist']) recoil.basisMatrix = tank.node('G').localMatrix recoil = assemblerModule.createGunAnimator(vehicleDesc, tank.node('G').localMatrix) recoil.lodSetting = 10 tank.node('G', recoil) gunFashion.gunLocalMatrix = recoil recoil.lodLink = DataLinks.createFloatLink(chassisFashion, 'lastLod') swingingAnimator = assemblerModule.createSwingingAnimator( vehicleDesc, tank.node('hull').localMatrix, worldMatrix) chassisFashion.setupSwinging(swingingAnimator, 'hull') swingingAnimator.lodLink = DataLinks.createFloatLink( chassisFashion, 'lastLod') tank.setupFashions([chassisFashion, None, None, gunFashion]) fashions.append(swingingAnimator) tank.node('hull', swingingAnimator) animMatrix = Math.MatrixAnimation() keys = [] for x in xrange(100): angle = math.pi * 0.5 * (1 if x & 1 else -1) keys.append((x * 3, mathUtils.createRotationMatrix((angle, 0, 0)))) animMatrix.keyframes = tuple(keys) tank.node('turret', animMatrix) return
def computeTransform(confDict): matDict = { 'preRotate': math_utils.createIdentityMatrix(), 'postRotate': math_utils.createIdentityMatrix(), 'vect': math_utils.createIdentityMatrix() } if any( isinstance(confDict[confKey][0], tuple) for confKey in matDict.keys()): for confKey in matDict.keys(): if isinstance(confDict[confKey][0], tuple): keyframes = [] for keyframe in confDict[confKey]: timeStamp, value = keyframe if 'vect' in confKey: Mat = math_utils.createTranslationMatrix(value) else: Mat = math_utils.createRotationMatrix(value) keyframes.append((timeStamp, Mat)) MatAn = Math.MatrixAnimation() MatAn.keyframes = keyframes MatAn.time = 0.0 MatAn.loop = True elif 'vect' in confKey: MatAn = math_utils.createTranslationMatrix(confDict[confKey]) else: MatAn = math_utils.createRotationMatrix(confDict[confKey]) matDict[confKey] = MatAn matProd = math_utils.MatrixProviders.product(matDict['vect'], matDict['postRotate']) LightMat = math_utils.MatrixProviders.product(matDict['preRotate'], matProd) else: preRotate = math_utils.createRotationMatrix(confDict['preRotate']) postRotate = math_utils.createRotationMatrix(confDict['postRotate']) LightMat = math_utils.createTranslationMatrix(confDict['vect']) LightMat.postMultiply(postRotate) LightMat.preMultiply(preRotate) return LightMat
def __init__(self): m = Math.Matrix() m.setIdentity() self.__animMat = Math.MatrixAnimation() self.__animMat.keyframes = ((0.0, m), )
def _makeDefaultProvider(): dataProvider = GUI.WGGunMarkerDataProvider() dataProvider.positionMatrixProvider = Math.MatrixAnimation() dataProvider.setStartSize(_setupGunMarkerSizeLimits(dataProvider)[0]) return dataProvider