def selectPlacement(self, placement):
     if self.__vehicle is None:
         return
     else:
         self.__placement = placement
         self.__lookAtProvider = None
         if placement == _VehicleBounder.SELECT_CHASSIS:
             self.matrix = self.__vehicle.matrix
         elif placement == _VehicleBounder.SELECT_TURRET:
             self.matrix = AimingSystems.getTurretMatrixProvider(
                 self.__vehicle.typeDescriptor, self.__vehicle.matrix,
                 self.__vehicle.appearance.turretMatrix)
         elif placement == _VehicleBounder.SELECT_GUN:
             turretMatrixProv = AimingSystems.getTurretMatrixProvider(
                 self.__vehicle.typeDescriptor, self.__vehicle.matrix,
                 self.__vehicle.appearance.turretMatrix)
             self.matrix = AimingSystems.getGunMatrixProvider(
                 self.__vehicle.typeDescriptor, turretMatrixProv,
                 self.__vehicle.appearance.gunMatrix)
         elif placement == _VehicleBounder.SELECT_LOOK_AT:
             self.matrix = mathUtils.createIdentityMatrix()
             self.__lookAtProvider = mathUtils.MatrixProviders.product(
                 mathUtils.createTranslationMatrix(self.__boundLocalPos),
                 self.__vehicle.matrix)
         return
Ejemplo n.º 2
0
 def __init__(self):
     self.matrix = mathUtils.createIdentityMatrix()
     self.__boundLocalPos = None
     self.__vehicle = None
     self.__lookAtProvider = None
     self.__placement = _VehicleBounder.SELECT_CHASSIS
     return
Ejemplo n.º 3
0
    def attach(self, compoundModel, isDamaged, showDamageStickers):
        for componentName, attachNodeName in VehicleStickers.COMPONENT_NAMES:
            idx = TankPartNames.getIdx(componentName)
            node = compoundModel.node(attachNodeName)
            if node is None:
                continue
            geometryLink = compoundModel.getPartGeometryLink(idx)
            componentStickers = self.__stickers[componentName]
            componentStickers.stickers.attachStickers(geometryLink, node, isDamaged)
            if showDamageStickers:
                for damageSticker in componentStickers.damageStickers.itervalues():
                    if damageSticker.handle is not None:
                        componentStickers.stickers.delDamageSticker(damageSticker.handle)
                        damageSticker.handle = None
                        LOG_WARNING('Adding %s damage sticker to occupied slot' % componentName)
                    damageSticker.handle = componentStickers.stickers.addDamageSticker(damageSticker.stickerID, damageSticker.rayStart, damageSticker.rayEnd)

        if isDamaged:
            gunNode = compoundModel.node(TankPartNames.GUN)
        elif self.__animateGunInsignia:
            gunNode = compoundModel.node(TankNodeNames.GUN_INCLINATION) if isDamaged else compoundModel.node(VehicleStickers.__INSIGNIA_NODE_NAME)
        else:
            gunNode = compoundModel.node(TankNodeNames.GUN_INCLINATION)
        if gunNode is None:
            return
        else:
            gunGeometry = compoundModel.getPartGeometryLink(TankPartIndexes.GUN)
            if isDamaged:
                toPartRoot = mathUtils.createIdentityMatrix()
            else:
                toPartRoot = Math.Matrix(gunNode)
                toPartRoot.invert()
                toPartRoot.preMultiply(compoundModel.node(TankNodeNames.GUN_INCLINATION))
            self.__stickers['gunInsignia'].stickers.attachStickers(gunGeometry, gunNode, isDamaged, toPartRoot)
            return
 def __init__(self, model, nodeToAttach):
     self.__model = model
     self.__stickerModel = BigWorld.WGStickerModel()
     self.__stickerModel.setLODDistance(1000.0)
     self.__stickerModel.setupSuperModel(model, mathUtils.createIdentityMatrix())
     nodeToAttach.attach(self.__stickerModel)
     self.__damageStickers = {}
Ejemplo n.º 5
0
 def __init_sound(self):
     if BigWorld.player() is not None and BigWorld.player().getVehicleAttached() is not None:
         self.connectSoundToMatrix(BigWorld.player().getVehicleAttached().appearance.modelsDesc['turret']['model'].matrix)
     else:
         self.connectSoundToMatrix(mathUtils.createIdentityMatrix())
     self.delayCallback(self.__updatePeriod, self.__update)
     return
Ejemplo n.º 6
0
 def __refineVehicleMProv(self, vehicleMProv):
     vehicleTranslationOnly = Math.WGTranslationOnlyMP()
     vehicleTranslationOnly.source = vehicleMProv
     refinedMatrixProvider = Math.MatrixProduct()
     refinedMatrixProvider.a = mathUtils.createIdentityMatrix()
     refinedMatrixProvider.b = vehicleTranslationOnly
     return refinedMatrixProvider
Ejemplo n.º 7
0
 def __refineVehicleMProv(self, vehicleMProv):
     vehicleTranslationOnly = Math.WGTranslationOnlyMP()
     vehicleTranslationOnly.source = vehicleMProv
     refinedMatrixProvider = Math.MatrixProduct()
     refinedMatrixProvider.a = mathUtils.createIdentityMatrix()
     refinedMatrixProvider.b = vehicleTranslationOnly
     return refinedMatrixProvider
Ejemplo n.º 8
0
 def selectPlacement(self, placement):
     if self.__vehicle is None:
         return
     else:
         self.__placement = placement
         self.__lookAtProvider = None
         if placement == _VehicleBounder.SELECT_CHASSIS:
             self.matrix = self.__vehicle.matrix
         elif placement == _VehicleBounder.SELECT_TURRET:
             self.matrix = AimingSystems.getTurretMatrixProvider(
                 self.__vehicle.typeDescriptor, self.__vehicle.matrix, self.__vehicle.appearance.turretMatrix
             )
         elif placement == _VehicleBounder.SELECT_GUN:
             turretMatrixProv = AimingSystems.getTurretMatrixProvider(
                 self.__vehicle.typeDescriptor, self.__vehicle.matrix, self.__vehicle.appearance.turretMatrix
             )
             self.matrix = AimingSystems.getGunMatrixProvider(
                 self.__vehicle.typeDescriptor, turretMatrixProv, self.__vehicle.appearance.gunMatrix
             )
         elif placement == _VehicleBounder.SELECT_LOOK_AT:
             self.matrix = mathUtils.createIdentityMatrix()
             self.__lookAtProvider = mathUtils.MatrixProviders.product(
                 mathUtils.createTranslationMatrix(self.__boundLocalPos), self.__vehicle.matrix
             )
         return
 def __init__(self):
     self.matrix = mathUtils.createIdentityMatrix()
     self.__boundLocalPos = None
     self.__vehicle = None
     self.__lookAtProvider = None
     self.__placement = _VehicleBounder.SELECT_CHASSIS
     return
 def enable(self, **args):
     self.measureDeltaTime()
     self.delayCallback(0.0, self._update)
     camMatrix = args.get('camMatrix', BigWorld.camera().matrix)
     self._cam.set(camMatrix)
     self._cam.invViewProvider.a = camMatrix
     self._cam.invViewProvider.b = mathUtils.createIdentityMatrix()
     BigWorld.camera(self._cam)
     worldMat = Math.Matrix(self._cam.invViewMatrix)
     self.__ypr = Math.Vector3(worldMat.yaw, worldMat.pitch, worldMat.roll)
     self.__position = worldMat.translation
     self.__velocity = Math.Vector3()
     self.__yprVelocity = Math.Vector3()
     self.__zoomVelocity = 0.0
     self.__resetSenses()
     self.__basisMProv.bind(None)
     self.__rotateAroundPointEnabled = False
     self._alignerToLand.disable()
     self._cam.speedTreeTarget = self._cam.invViewMatrix
     self.resetMovement()
     cameraTransitionDuration = args.get('transitionDuration', -1)
     if cameraTransitionDuration > 0:
         previousCamMatrix = args.get('camMatrix', None)
         self.__setupCameraTransition(cameraTransitionDuration,
                                      previousCamMatrix)
     if isPlayerAvatar() and self.guiSessionProvider.getCtx(
     ).isPlayerObserver():
         BigWorld.player().positionControl.moveTo(self.__position)
         BigWorld.player().positionControl.followCamera(True)
     return
Ejemplo n.º 11
0
 def __init_sound(self):
     if BigWorld.player() is not None and BigWorld.player().getVehicleAttached() is not None:
         compoundModel = BigWorld.player().getVehicleAttached().appearance.compoundModel
         self.connectSoundToMatrix(compoundModel.node(TankPartNames.TURRET))
     else:
         self.connectSoundToMatrix(mathUtils.createIdentityMatrix())
     self.delayCallback(self.__updatePeriod, self.__update)
     return
Ejemplo n.º 12
0
 def __prepareModelAssembler(self):
     assembler = BigWorld.CompoundAssembler(self.__vehDescr.name, self.spaceID)
     skeleton = tankStructure.CRASHED_SKELETON
     turretModel = self.__vehDescr.turret['models']['exploded']
     gunModel = self.__vehDescr.gun['models']['exploded']
     assembler.addRootPart(turretModel, TankPartNames.TURRET, skeleton.turret, mathUtils.createIdentityMatrix())
     assembler.addPart(gunModel, TankNodeNames.GUN_JOINT, TankPartNames.GUN, skeleton.gun, mathUtils.createIdentityMatrix())
     return assembler
Ejemplo n.º 13
0
 def __init_sound(self):
     if BigWorld.player() is not None and BigWorld.player().getVehicleAttached() is not None:
         compoundModel = BigWorld.player().getVehicleAttached().appearance.compoundModel
         self.connectSoundToMatrix(compoundModel.node(TankPartNames.TURRET))
     else:
         self.connectSoundToMatrix(mathUtils.createIdentityMatrix())
     self.delayCallback(self.__updatePeriod, self.__update)
     return
Ejemplo n.º 14
0
 def bind(self, vehicle, bindWorldPos = None):
     self.__vehicle = vehicle
     if vehicle is None:
         self.matrix = mathUtils.createIdentityMatrix()
         self.__lookAtProvider = None
         return
     toLocalMat = Matrix(vehicle.matrix)
     toLocalMat.invert()
     self.__boundLocalPos = None if bindWorldPos is None else toLocalMat.applyPoint(bindWorldPos)
     self.selectPlacement(_VehicleBounder.SELECT_CHASSIS)
Ejemplo n.º 15
0
 def __init__(self):
     self.enabled = False
     self._projectileMP = Math.WGAdaptiveMatrixProvider()
     self._projectileMP.target = mathUtils.createIdentityMatrix()
     self._projectileID = None
     self._trackProjectile = False
     self._trackProjectileStartPoint = None
     self._trackProjectileVelocity = None
     self._trackProjectileStartTime = 0.0
     self._followProjectileKey = eval(BigWorld._ba_config['spg']['followProjectileKey'])
Ejemplo n.º 16
0
 def __init__(self):
     self.enabled = False
     self._projectileMP = Math.WGAdaptiveMatrixProvider()
     self._projectileMP.target = mathUtils.createIdentityMatrix()
     self._projectileID = None
     self._trackProjectile = False
     self._trackProjectileStartPoint = None
     self._trackProjectileVelocity = None
     self._trackProjectileStartTime = 0.0
     self._followProjectileKey = eval(
         BigWorld._ba_config['spg']['followProjectileKey'])
Ejemplo n.º 17
0
    def attach(self,
               compoundModel,
               isDamaged,
               showDamageStickers,
               isDetachedTurret=False):
        for componentName, attachNodeName in VehicleStickers.COMPONENT_NAMES:
            idx = DetachedTurretPartNames.getIdx(
                componentName) if isDetachedTurret else TankPartNames.getIdx(
                    componentName)
            node = compoundModel.node(attachNodeName)
            if node is None:
                continue
            geometryLink = compoundModel.getPartGeometryLink(idx)
            componentStickers = self.__stickers[componentName]
            componentStickers.stickers.attachStickers(geometryLink, node,
                                                      isDamaged)
            if showDamageStickers:
                for damageSticker in componentStickers.damageStickers.itervalues(
                ):
                    if damageSticker.handle is not None:
                        componentStickers.stickers.delDamageSticker(
                            damageSticker.handle)
                        damageSticker.handle = None
                        LOG_WARNING(
                            'Adding %s damage sticker to occupied slot' %
                            componentName)
                    damageSticker.handle = componentStickers.stickers.addDamageSticker(
                        damageSticker.stickerID, damageSticker.rayStart,
                        damageSticker.rayEnd)

        if isDamaged:
            gunNode = compoundModel.node(TankPartNames.GUN)
        elif self.__animateGunInsignia:
            gunNode = compoundModel.node(VehicleStickers.__INSIGNIA_NODE_NAME)
        else:
            gunNode = compoundModel.node(TankNodeNames.GUN_INCLINATION)
        if gunNode is None:
            return
        else:
            gunGeometry = compoundModel.getPartGeometryLink(
                DetachedTurretPartIndexes.GUN
            ) if isDetachedTurret else compoundModel.getPartGeometryLink(
                TankPartIndexes.GUN)
            if isDamaged:
                toPartRoot = mathUtils.createIdentityMatrix()
            else:
                toPartRoot = Math.Matrix(gunNode)
                toPartRoot.invert()
                toPartRoot.preMultiply(
                    compoundModel.node(TankNodeNames.GUN_INCLINATION))
            self.__stickers['gunInsignia'].stickers.attachStickers(
                gunGeometry, gunNode, isDamaged, toPartRoot)
            return
Ejemplo n.º 18
0
 def bind(self, vehicle, bindWorldPos = None):
     self.__vehicle = vehicle
     if vehicle is None:
         self.matrix = mathUtils.createIdentityMatrix()
         self.__lookAtProvider = None
         return
     else:
         toLocalMat = Matrix(vehicle.matrix)
         toLocalMat.invert()
         self.__boundLocalPos = None if bindWorldPos is None else toLocalMat.applyPoint(bindWorldPos)
         self.selectPlacement(_VehicleBounder.SELECT_CHASSIS)
         return
Ejemplo n.º 19
0
def createSwingingAnimator(vehicleDesc, basisMatrix = None, worldMProv = None):
    swingingAnimator = BigWorld.SwingingAnimator()
    swingingAnimator.basisMatrix = basisMatrix
    swingingCfg = vehicleDesc.hull['swinging']
    pp = tuple((p * m for p, m in zip(swingingCfg['pitchParams'], (0.9, 1.88, 0.3, 4.0, 1.0, 1.0))))
    swingingAnimator.setupPitchSwinging(*pp)
    swingingAnimator.setupRollSwinging(*swingingCfg['rollParams'])
    swingingAnimator.setupShotSwinging(swingingCfg['sensitivityToImpulse'])
    swingingAnimator.maxMovementSpeed = vehicleDesc.physics['speedLimits'][0]
    swingingAnimator.lodSetting = swingingCfg['lodDist']
    swingingAnimator.worldMatrix = worldMProv if worldMProv is not None else mathUtils.createIdentityMatrix()
    return swingingAnimator
Ejemplo n.º 20
0
def computeTransform(confDict):
    matDict = {
        'preRotate': mathUtils.createIdentityMatrix(),
        'postRotate': mathUtils.createIdentityMatrix(),
        'vect': mathUtils.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 = mathUtils.createTranslationMatrix(value)
                    else:
                        Mat = mathUtils.createRotationMatrix(value)
                    keyframes.append((timeStamp, Mat))
                MatAn = Math.MatrixAnimation()
                MatAn.keyframes = keyframes
                MatAn.time = 0.0
                MatAn.loop = True
            elif 'vect' in confKey:
                MatAn = mathUtils.createTranslationMatrix(confDict[confKey])
            else:
                MatAn = mathUtils.createRotationMatrix(confDict[confKey])
            matDict[confKey] = MatAn

        matProd = mathUtils.MatrixProviders.product(matDict['vect'],
                                                    matDict['postRotate'])
        LightMat = mathUtils.MatrixProviders.product(matDict['preRotate'],
                                                     matProd)
    else:
        preRotate = mathUtils.createRotationMatrix(confDict['preRotate'])
        postRotate = mathUtils.createRotationMatrix(confDict['postRotate'])
        LightMat = mathUtils.createTranslationMatrix(confDict['vect'])
        LightMat.postMultiply(postRotate)
        LightMat.preMultiply(preRotate)
    return LightMat
def createSwingingAnimator(vehicleDesc, basisMatrix=None, worldMProv=None, lodLink=None):
    swingingAnimator = Vehicular.SwingingAnimator()
    swingingAnimator.basisMatrix = basisMatrix
    swingingCfg = vehicleDesc.hull.swinging
    pp = tuple((p * m for p, m in zip(swingingCfg.pitchParams, (0.9, 1.88, 0.3, 4.0, 1.0, 1.0))))
    swingingAnimator.setupPitchSwinging(*pp)
    swingingAnimator.setupRollSwinging(*swingingCfg.rollParams)
    swingingAnimator.setupShotSwinging(swingingCfg.sensitivityToImpulse)
    swingingAnimator.maxMovementSpeed = vehicleDesc.physics['speedLimits'][0]
    swingingAnimator.lodSetting = swingingCfg.lodDist
    swingingAnimator.worldMatrix = worldMProv if worldMProv is not None else mathUtils.createIdentityMatrix()
    swingingAnimator.lodLink = lodLink
    return swingingAnimator
Ejemplo n.º 22
0
def nodeWatcher(section, nodeName, upperMat=mathUtils.createIdentityMatrix()):
    retMat = None
    for curName, curSect in section.items():
        if curName == 'node':
            returnMat = Math.Matrix()
            returnMat.set(upperMat)
            returnMat.postMultiply(curSect['transform'].asMatrix)
            if curSect['identifier'].asString == nodeName:
                return returnMat
            retMat = nodeWatcher(curSect, nodeName, returnMat)
            if retMat is not None:
                return retMat

    return retMat
Ejemplo n.º 23
0
def prepareCompoundAssembler(vehicleDesc,
                             modelStateName,
                             spaceID,
                             isTurretDetached=False):
    if constants.IS_DEVELOPMENT and modelStateName not in VehicleDamageState.MODEL_STATE_NAMES:
        raise Exception('Invalid modelStateName %s, must be in %s' %
                        (modelStateName, VehicleDamageState.MODEL_STATE_NAMES))
    if spaceID is None:
        spaceID = BigWorld.player().spaceID
    partModels = getPartModelsFromDesc(vehicleDesc, modelStateName)
    chassis, hull, turret, gun = partModels
    assembler = BigWorld.CompoundAssembler()
    skeleton = getSkeleton(vehicleDesc, modelStateName)
    assembler.addRootPart(chassis, TankPartNames.CHASSIS, skeleton.chassis,
                          mathUtils.createIdentityMatrix())
    assembler.emplacePart(hull, 'V', TankPartNames.HULL, skeleton.hull)
    turretJointName = vehicleDesc.hull['turretHardPoints'][0]
    assembler.renameNode(turretJointName, TankNodeNames.TURRET_JOINT)
    if not isTurretDetached:
        assembler.addPart(turret, TankNodeNames.TURRET_JOINT,
                          TankPartNames.TURRET, skeleton.turret,
                          mathUtils.createIdentityMatrix())
        assembler.addPart(gun, TankNodeNames.GUN_JOINT, TankPartNames.GUN,
                          skeleton.gun, mathUtils.createIdentityMatrix())
    cornerPoint = vehicleDesc.chassis['topRightCarryingPoint']
    assembler.addDummyNode(
        TankPartNames.CHASSIS, TankNodeNames.TRACK_LEFT_MID,
        mathUtils.createTranslationMatrix((-cornerPoint[0], 0, 0)))
    assembler.addDummyNode(
        TankPartNames.CHASSIS, TankNodeNames.TRACK_RIGHT_MID,
        mathUtils.createTranslationMatrix((cornerPoint[0], 0, 0)))
    assembler.addDummyNode(TankPartNames.CHASSIS,
                           TankNodeNames.CHASSIS_MID_TRAIL)
    assembler.assemblerName = vehicleDesc.name
    assembler.spaceID = spaceID
    return assembler
Ejemplo n.º 24
0
def createSwingingAnimator(vehicleDesc, basisMatrix=None, worldMProv=None):
    swingingAnimator = BigWorld.SwingingAnimator()
    swingingAnimator.basisMatrix = basisMatrix
    swingingCfg = vehicleDesc.hull['swinging']
    pp = tuple((p * m
                for p, m in zip(swingingCfg['pitchParams'], (0.9, 1.88, 0.3,
                                                             4.0, 1.0, 1.0))))
    swingingAnimator.setupPitchSwinging(*pp)
    swingingAnimator.setupRollSwinging(*swingingCfg['rollParams'])
    swingingAnimator.setupShotSwinging(swingingCfg['sensitivityToImpulse'])
    swingingAnimator.maxMovementSpeed = vehicleDesc.physics['speedLimits'][0]
    swingingAnimator.lodSetting = swingingCfg['lodDist']
    swingingAnimator.worldMatrix = worldMProv if worldMProv is not None else mathUtils.createIdentityMatrix(
    )
    return swingingAnimator
Ejemplo n.º 25
0
 def __init__(self, vDesc, emblemSlots, onHull = True, insigniaRank = 0):
     self.__slotsByType = {}
     self.__texParamsBySlotType = {}
     self.__isLoadingClanEmblems = False
     self.__clanID = 0
     self.__vehicleDescriptor = vDesc
     self.__model = None
     self.__toPartRootMatrix = mathUtils.createIdentityMatrix()
     self.__parentNode = None
     self.__isDamaged = False
     self.__calcTexParams(vDesc, emblemSlots, onHull, insigniaRank)
     if 'clan' in self.__texParamsBySlotType:
         self.__texParamsBySlotType[SlotTypes.CLAN] = [TextureParams('', '', False)]
     self.__stickerModel = BigWorld.WGStickerModel()
     self.__stickerModel.setLODDistance(vDesc.type.emblemsLodDist)
     return
Ejemplo n.º 26
0
 def __init__(self, vDesc, emblemSlots, onHull=True, insigniaRank=0):
     self.__slotsByType = {}
     self.__texParamsBySlotType = {}
     self.__isLoadingClanEmblems = False
     self.__clanID = 0
     self.__vehicleDescriptor = vDesc
     self.__model = None
     self.__toPartRootMatrix = mathUtils.createIdentityMatrix()
     self.__parentNode = None
     self.__isDamaged = False
     self.__calcTexParams(vDesc, emblemSlots, onHull, insigniaRank)
     if 'clan' in self.__texParamsBySlotType:
         self.__texParamsBySlotType[SlotTypes.CLAN] = [
             TextureParams('', '', False)
         ]
     self.__stickerModel = BigWorld.WGStickerModel()
     self.__stickerModel.setLODDistance(vDesc.type.emblemsLodDist)
     return
Ejemplo n.º 27
0
 def enable(self, **args):
     self.measureDeltaTime()
     self.delayCallback(0.0, self.__update)
     camMatrix = args.get('camMatrix', BigWorld.camera().matrix)
     self.__cam.set(camMatrix)
     self.__cam.invViewProvider.a = camMatrix
     self.__cam.invViewProvider.b = mathUtils.createIdentityMatrix()
     BigWorld.camera(self.__cam)
     worldMat = Math.Matrix(self.__cam.invViewMatrix)
     self.__ypr = Math.Vector3(worldMat.yaw, worldMat.pitch, worldMat.roll)
     self.__position = worldMat.translation
     self.__velocity = Math.Vector3()
     self.__yprVelocity = Math.Vector3()
     self.__zoomVelocity = 0.0
     self.__resetSenses()
     self.__basisMProv.bind(None)
     self.__rotateAroundPointEnabled = False
     self.__alignerToLand.disable()
     if isPlayerAvatar() and g_sessionProvider.getCtx().isPlayerObserver():
         BigWorld.player().positionControl.moveTo(self.__position)
         BigWorld.player().positionControl.followCamera(True)
def prepareCompoundAssembler(vehicleDesc, modelStateName, spaceID, isTurretDetached = False):
    if constants.IS_DEVELOPMENT and modelStateName not in VehicleDamageState.MODEL_STATE_NAMES:
        raise Exception('Invalid modelStateName %s, must be in %s' % (modelStateName, VehicleDamageState.MODEL_STATE_NAMES))
    if spaceID is None:
        spaceID = BigWorld.player().spaceID
    partModels = getPartModelsFromDesc(vehicleDesc, modelStateName)
    chassis, hull, turret, gun = partModels
    assembler = BigWorld.CompoundAssembler()
    skeleton = getSkeleton(vehicleDesc, modelStateName)
    assembler.addRootPart(chassis, TankPartNames.CHASSIS, skeleton.chassis, mathUtils.createIdentityMatrix())
    assembler.emplacePart(hull, 'V', TankPartNames.HULL, skeleton.hull)
    turretJointName = vehicleDesc.hull['turretHardPoints'][0]
    assembler.renameNode(turretJointName, TankNodeNames.TURRET_JOINT)
    if not isTurretDetached:
        assembler.addPart(turret, TankNodeNames.TURRET_JOINT, TankPartNames.TURRET, skeleton.turret, mathUtils.createIdentityMatrix())
        assembler.addPart(gun, TankNodeNames.GUN_JOINT, TankPartNames.GUN, skeleton.gun, mathUtils.createIdentityMatrix())
    cornerPoint = vehicleDesc.chassis['topRightCarryingPoint']
    assembler.addDummyNode(TankPartNames.CHASSIS, TankNodeNames.TRACK_LEFT_MID, mathUtils.createTranslationMatrix((-cornerPoint[0], 0, 0)))
    assembler.addDummyNode(TankPartNames.CHASSIS, TankNodeNames.TRACK_RIGHT_MID, mathUtils.createTranslationMatrix((cornerPoint[0], 0, 0)))
    assembler.addDummyNode(TankPartNames.CHASSIS, TankNodeNames.CHASSIS_MID_TRAIL)
    assembler.assemblerName = vehicleDesc.name
    assembler.spaceID = spaceID
    return assembler
Ejemplo n.º 29
0
def attach(vehicleID, modID=None, visible=False):
    if vehicleID not in dynamic_db:
        return
    for mod, dyn in dynamic_db[vehicleID].iteritems():
        if modID is not None and modID != mod:
            continue
        dyn['entered'] = True
        if not dyn['loaded']:
            return
        vEntity = BigWorld.entity(vehicleID)
        if vEntity is None:
            return
        if hasattr(vEntity, 'appearance'):
            compoundModel = vEntity.appearance.compoundModel
        else:
            compoundModel = vEntity.model
        scaleMat = mathUtils.createIdentityMatrix()
        attachMode = dyn['mode']
        if 'scale' in attachMode:
            scaleMat.setScale(Math.Vector3(1.025))
        for modelDict in dyn['models'].itervalues():
            model = modelDict['model']
            if model is not None:
                if 'attach' in attachMode:
                    try:
                        compoundModel.node(modelDict['nodeName']).attach(model, scaleMat)
                    except StandardError:
                        if g_config.data['isDebug']:
                            traceback.print_exc()
                elif 'motor' in attachMode:
                    if model not in BigWorld.models():
                        modelDict['motor'] = motor = BigWorld.Servo(
                            mathUtils.MatrixProviders.product(compoundModel.node(modelDict['nodeName']), scaleMat))
                        model.addMotor(motor)
                        BigWorld.addModel(model)
                model.visible = visible and dyn['visible']
Ejemplo n.º 30
0
def lightsCreate(vehicleID, callPlace=''):
    try:
        vehicle = BigWorld.player().arena.vehicles[vehicleID]
        vEntity = BigWorld.entity(vehicleID)
        if vEntity is None:
            return
        vDesc = vEntity.typeDescriptor
        if vehicleID == BigWorld.player().playerVehicleID:
            print 'LampLights: Create at %s' % callPlace
        constNodesList = [
            TankNodeNames.TRACK_LEFT_UP_FRONT,
            TankNodeNames.TRACK_LEFT_UP_REAR,
            TankNodeNames.TRACK_RIGHT_UP_FRONT,
            TankNodeNames.TRACK_RIGHT_UP_REAR
        ]
        compoundModel = vEntity.appearance.compoundModel
        nodeListML, nodeListNL = findWheelNodes(vehicleID, 'L')
        nodeListMR, nodeListNR = findWheelNodes(vehicleID, 'R')
        fakesDict[vehicleID] = fakeDict = {}
        fakeMotorsDict[vehicleID] = fakeMotorDict = {}

        sourcesDict = {TankPartNames.CHASSIS: None, TankPartNames.HULL: None}
        for tankPartName in sourcesDict.keys():
            curSource = getattr(vDesc, tankPartName).models.undamaged
            modelSec = ResMgr.openSection(curSource)
            if modelSec is None:
                print 'LampLights: file not found:', curSource
            sourceSecStr = modelSec['nodefullVisual'].asString
            sourceSec = ResMgr.openSection(sourceSecStr + '.visual')
            if sourceSec is None:
                sourceSec = ResMgr.openSection(sourceSecStr +
                                               '.visual_processed')
            if sourceSec is None:
                print 'LampLights: visual not found for', curSource
                print callPlace
            else:
                sourcesDict[tankPartName] = sourceSec
        HullMat = mathUtils.createIdentityMatrix()
        deHullMat = mathUtils.createIdentityMatrix()
        if sourcesDict[TankPartNames.CHASSIS] is not None:
            deHullMat = nodeWatcher(sourcesDict[TankPartNames.CHASSIS], 'V')
            deHullMat.invert()
        for tankPartName in (TankPartNames.CHASSIS, TankPartNames.HULL):
            fakeDict[tankPartName] = BigWorld.Model('objects/fake_model.model')
            fakeDict[tankPartName +
                     'Root'] = BigWorld.Model('objects/fake_model.model')
            compoundModel.node(TankPartNames.HULL).attach(
                fakeDict[tankPartName + 'Root'],
                HullMat if 'hull' in tankPartName else deHullMat)
            if fakeMotorDict.get(tankPartName) not in tuple(
                    fakeDict[tankPartName].motors):
                fakeMotorDict[tankPartName] = BigWorld.Servo(
                    fakeDict[tankPartName + 'Root'].matrix)
                fakeDict[tankPartName].addMotor(fakeMotorDict[tankPartName])
            if fakeDict[tankPartName] not in tuple(BigWorld.models()):
                BigWorld.addModel(fakeDict[tankPartName])
        for idx, node in enumerate(nodeListNL):
            fakeDict[node] = BigWorld.Model('objects/fake_model.model')
            fakeDict[TankPartNames.CHASSIS].node('', nodeListML[idx]).attach(
                fakeDict[node])

        for idx, node in enumerate(nodeListNR):
            fakeDict[node] = BigWorld.Model('objects/fake_model.model')
            fakeDict[TankPartNames.CHASSIS].node('', nodeListMR[idx]).attach(
                fakeDict[node])

        for node in constNodesList:
            fakeDict[node] = BigWorld.Model('objects/fake_model.model')
            restoreMat = mathUtils.createIdentityMatrix()
            transMat = None
            isChassis = False
            if sourcesDict[TankPartNames.HULL] is not None:
                transMat = nodeWatcher(sourcesDict[TankPartNames.HULL], node)
            if transMat is None and sourcesDict[
                    TankPartNames.CHASSIS] is not None:
                transMat = nodeWatcher(sourcesDict[TankPartNames.CHASSIS],
                                       node)
                if transMat is None:
                    transMat = nodeWatcher(sourcesDict[TankPartNames.CHASSIS],
                                           node.replace('Up', ''))
                isChassis = True
            if transMat is None:
                print _config.ID + ': restore Matrix not found for node', node, 'in', vDesc.hull.models.undamaged
                print callPlace
            else:
                restoreMat.setTranslate(transMat.translation)
            fakeDict[TankPartNames.HULL if not isChassis else TankPartNames.
                     CHASSIS].node('', restoreMat).attach(fakeDict[node])

        fakeDict[TankPartNames.GUN +
                 'Root'] = BigWorld.Model('objects/fake_model.model')
        compoundModel.node(TankPartNames.GUN).attach(
            fakeDict[TankPartNames.GUN + 'Root'])
        fakeDict[TankPartNames.GUN] = BigWorld.Model(
            'objects/fake_model.model')
        if fakeMotorDict.get(TankPartNames.GUN) not in tuple(
                fakeDict[TankPartNames.GUN].motors):
            fakeMotorDict[TankPartNames.GUN] = BigWorld.Servo(
                fakeDict[TankPartNames.GUN + 'Root'].matrix)
            fakeDict[TankPartNames.GUN].addMotor(
                fakeMotorDict[TankPartNames.GUN])
        if fakeDict[TankPartNames.GUN] not in tuple(BigWorld.models()):
            BigWorld.addModel(fakeDict[TankPartNames.GUN])
        fakeDict[TankPartNames.TURRET] = BigWorld.Model(
            'objects/fake_model.model')
        fakeDict[TankPartNames.TURRET +
                 'Root'] = BigWorld.Model('objects/fake_model.model')
        fakeDict[TankPartNames.TURRET +
                 'RootRoot'] = BigWorld.Model('objects/fake_model.model')
        hull_bbox_min, hull_bbox_max, _ = vDesc.hull.hitTester.bbox
        turret_pos_on_hull = vDesc.hull.turretPositions[0]
        turret_bbox_max = vDesc.turret.hitTester.bbox[1]
        gun_pos_on_turret = vDesc.turret.gunPosition
        gun_pos_on_hull = gun_pos_on_turret + turret_pos_on_hull
        gun_bbox_max = vDesc.gun.hitTester.bbox[1]
        if hull_bbox_max.y >= turret_pos_on_hull.y + turret_bbox_max.y:
            observer_pos = Math.Vector3(0, hull_bbox_max.y, 0)
            node = TankPartNames.HULL
        elif gun_pos_on_turret.y + gun_bbox_max.y >= turret_bbox_max.y:
            observer_pos = Math.Vector3(0, gun_bbox_max.y, 0)
            node = TankPartNames.GUN
        else:
            observer_pos = Math.Vector3(0, turret_bbox_max.y, 0)
            node = TankPartNames.TURRET
        mat = Math.Matrix()
        mat.setTranslate(observer_pos)
        compoundModel.node(node).attach(fakeDict[TankPartNames.TURRET +
                                                 'RootRoot'])
        if fakeMotorDict.get(TankPartNames.TURRET + 'Root') not in tuple(
                fakeDict[TankPartNames.TURRET + 'Root'].motors):
            fakeMotorDict[TankPartNames.TURRET + 'Root'] = BigWorld.Servo(
                fakeDict[TankPartNames.TURRET + 'RootRoot'].matrix)
            fakeDict[TankPartNames.TURRET + 'Root'].addMotor(
                fakeMotorDict[TankPartNames.TURRET + 'Root'])
        if fakeDict[TankPartNames.TURRET + 'Root'] not in tuple(
                BigWorld.models()):
            BigWorld.addModel(fakeDict[TankPartNames.TURRET + 'Root'])
        fakeDict[TankPartNames.TURRET + 'Root'].node('', mat).attach(
            fakeDict[TankPartNames.TURRET])

        hullLocalCenterY = (hull_bbox_min.y + hull_bbox_max.y) / 2.0
        hullLocalCenterZ = (hull_bbox_min.z + hull_bbox_max.z) / 2.0
        nodes = {
            'hullLocalPt1':
            Math.Vector3(0.0, hullLocalCenterY, hull_bbox_max.z),
            'hullLocalPt2':
            Math.Vector3(0.0, hullLocalCenterY, hull_bbox_min.z),
            'hullLocalPt3':
            Math.Vector3(hull_bbox_max.x, gun_pos_on_hull.y, hullLocalCenterZ),
            'hullLocalPt4':
            Math.Vector3(hull_bbox_min.x, gun_pos_on_hull.y, hullLocalCenterZ),
            'hullGunLocal':
            gun_pos_on_hull
        }
        for node in nodes:
            fakeDict[node] = BigWorld.Model('objects/fake_model.model')
            fakeDict[TankPartNames.HULL].node(
                '', mathUtils.createTranslationMatrix(nodes[node])).attach(
                    fakeDict[node])

        lightDBDict.setdefault(vehicleID, {})
        for configDict in _config.configsDict.values():
            for name in sorted(configDict.keys()):
                try:
                    if name in ('enable', 'meta', 'attachToPlayer',
                                'attachToAlly', 'attachToEnemy'):
                        continue
                    confDict = configDict[name]
                    needToAttach = \
                        confDict['attachToPlayer'] and vehicleID == BigWorld.player().playerVehicleID or \
                        confDict['attachToEnemy'] and vehicle['team'] != BigWorld.player().team or \
                        confDict['attachToAlly'] and vehicleID != BigWorld.player().playerVehicleID and \
                        vehicle['team'] == BigWorld.player().team
                    if not needToAttach:
                        continue
                    nodeL = []
                    if '.' in name:
                        nodeL.append(confDict['place'])
                    elif confDict['place'] == 'leftFront':
                        nodeL.append(TankNodeNames.TRACK_LEFT_UP_FRONT)
                    elif confDict['place'] == 'rightFront':
                        nodeL.append(TankNodeNames.TRACK_RIGHT_UP_FRONT)
                    elif confDict['place'] == 'leftRear':
                        nodeL.append(TankNodeNames.TRACK_LEFT_UP_REAR)
                    elif confDict['place'] == 'rightRear':
                        nodeL.append(TankNodeNames.TRACK_RIGHT_UP_REAR)
                    elif confDict['place'] == 'hull':
                        nodeL.append(TankPartNames.HULL)
                    elif confDict['place'] == 'turret':
                        nodeL.append(TankPartNames.TURRET)
                    elif confDict['place'] == 'spot':
                        nodeL.extend([TankPartNames.TURRET, TankPartNames.GUN])
                        nodeL.extend(
                            ['hullLocalPt%s' % num for num in xrange(1, 5)])
                        nodeL.append('hullGunLocal')
                    elif 'wheels' in confDict['place']:
                        if 'left' in confDict['place']:
                            nodeL.extend(nodeListNL)
                        else:
                            nodeL.extend(nodeListNR)

                    nameTree = name.split('.')[:-1]
                    namesList = []
                    for curKey in lightDBDict[vehicleID].keys():
                        curTree = curKey.split('.')
                        if len(curTree) != len(nameTree) or any(
                                upperName not in curTree[depth]
                                for depth, upperName in enumerate(nameTree)):
                            continue
                        namesList.append(curKey + '.' + name.split('.')[-1])
                    if not namesList:
                        namesList = [name]
                    for fullName in namesList:
                        for node in nodeL:
                            curName = fullName + ':' + node
                            if 'model' not in confDict['type']:
                                if confDict['type'] == 'spotLight':
                                    LightSource = BigWorld.PySpotLight()
                                    LightSource.coneAngle = confDict['ca']
                                else:
                                    LightSource = BigWorld.PyOmniLight()
                                    if confDict['type'] != 'omniLight':
                                        LOG_ERROR(
                                            'Unknown type of %s: %s. Set to omniLight'
                                            % (name, confDict['type']))
                                LightSource.innerRadius = confDict[
                                    'innerRadius']
                                LightSource.outerRadius = confDict[
                                    'outerRadius']
                                LightSource.castShadows = confDict['cs']
                                LightSource.multiplier = confDict['bright']
                                if isinstance(confDict['colour'][0], tuple):
                                    if confDict['type'] != 'spotLight':
                                        FrontLightShader = Math.Vector4Animation(
                                        )
                                        FrontLightShader.duration = confDict[
                                            'dur']
                                        FrontLightShader.keyframes = confDict[
                                            'colour']
                                        LightSource.colorAnimator = FrontLightShader
                                    else:
                                        LightSource.colour = confDict[
                                            'colour'][0][1]
                                else:
                                    LightSource.colour = confDict['colour']
                            else:
                                LightSource = BigWorld.Model(confDict['path'])
                            if '.' not in name:
                                if node in fakeDict:
                                    fakeNode = fakeDict[node].node(
                                        '', computeTransform(confDict))
                            else:
                                if curName not in fakeDict:
                                    fakeDict[curName] = BigWorld.Model(
                                        'objects/fake_model.model')
                                    lightDBDict[vehicleID][curName.rsplit(
                                        '.', 1)[0]].node(node).attach(
                                            fakeDict[curName])
                                fakeNode = fakeDict[curName].node(
                                    '', computeTransform(confDict))
                            if 'model' not in confDict['type']:
                                LightSource.source = fakeNode
                            elif not LightSource.attached:
                                fakeNode.attach(LightSource)
                            lightVisible(
                                LightSource, _config.isLampsVisible
                                and name in _config.modes['constant'])
                            lightDBDict[vehicleID][curName] = LightSource

                except StandardError:
                    traceback.print_exc()
                    print name
                    print callPlace
                    print vDesc.name

    except StandardError:
        traceback.print_exc()
        print callPlace
Ejemplo n.º 31
0
 def __init__(self):
     self._matrix = mathUtils.createIdentityMatrix()
Ejemplo n.º 32
0
 def __init__(self):
     self.__attachedVehicleMatrix = Math.WGAdaptiveMatrixProvider()
     self.__attachedVehicleMatrix.target = mathUtils.createIdentityMatrix()
     self.__ownVehicleMProv = Math.WGAdaptiveMatrixProvider()
     self.__ownVehicleMProv.target = mathUtils.createIdentityMatrix()
     self.onVehicleMatrixBindingChanged = Event()
Ejemplo n.º 33
0
 def __init__(self):
     self._matrix = mathUtils.createIdentityMatrix()
Ejemplo n.º 34
0
 def __init__(self):
     self.__attachedVehicleMatrix = Math.WGAdaptiveMatrixProvider()
     self.__attachedVehicleMatrix.target = mathUtils.createIdentityMatrix()
     self.__ownVehicleMProv = Math.WGAdaptiveMatrixProvider()
     self.__ownVehicleMProv.target = mathUtils.createIdentityMatrix()
     self.onVehicleMatrixBindingChanged = Event()
Ejemplo n.º 35
0
def new_setupModel(base, self, buildIdx):
    base(self, buildIdx)
    if not g_config.data['enabled']:
        return
    vEntityId = self._VehicleAppearance__vEntityId
    vEntity = BigWorld.entity(vEntityId)
    vDesc = self._VehicleAppearance__vDesc
    compoundModel = vEntity.model
    self.collisionLoaded = True
    self.modifiedModelsDesc = dict([(partName, {'model': None, 'matrix': None}) for partName in TankPartNames.ALL])
    self.modifiedModelsDesc.update([(
        '%s%d' % ((TankPartNames.ADDITIONAL_TURRET if idx % 2 == 0 else TankPartNames.ADDITIONAL_GUN), (idx + 2)/2),
        {'model': None, 'matrix': None})
        for idx in xrange(len(vDesc.turrets[1:]) * 2)])
    failList = []
    for partName in self.modifiedModelsDesc.keys():
        modelName = ''
        try:
            if 'additional' not in partName:
                modelName = getattr(vDesc, partName).hitTester.bspModelName
            else:
                _, addPartName, idxStr = partName.split('_')
                modelName = getattr(vDesc.turrets[int(idxStr)], addPartName).hitTester.bspModelName
            self.modifiedModelsDesc[partName]['model'] = model = BigWorld.Model(modelName)
            model.visible = False
        except StandardError:
            self.collisionLoaded = False
            failList.append(modelName if modelName else partName)
    if failList:
        print 'RemodEnabler: collision load failed: models not found'
        print failList
    if not self.collisionLoaded:
        return
    if any((g_config.data['collisionEnabled'], g_config.data['collisionComparisonEnabled'])):
        # Getting offset matrices
        hullOffset = mathUtils.createTranslationMatrix(vDesc.chassis.hullPosition)
        self.modifiedModelsDesc[TankPartNames.CHASSIS]['matrix'] = fullChassisMP = mathUtils.createIdentityMatrix()
        hullMP = mathUtils.MatrixProviders.product(mathUtils.createIdentityMatrix(), hullOffset)
        self.modifiedModelsDesc[TankPartNames.HULL]['matrix'] = fullHullMP = mathUtils.MatrixProviders.product(
            hullMP, fullChassisMP)
        for idx, turretPosition in enumerate(vDesc.hull.turretPositions):
            turretOffset = mathUtils.createTranslationMatrix(vDesc.hull.turretPositions[idx])
            gunOffset = mathUtils.createTranslationMatrix(vDesc.turrets[idx].turret.gunPosition)
        # Getting local transform matrices
            turretMP = mathUtils.MatrixProviders.product(mathUtils.createIdentityMatrix(), turretOffset)
            gunMP = mathUtils.MatrixProviders.product(mathUtils.createIdentityMatrix(), gunOffset)
            # turretMP = mathUtils.MatrixProviders.product(vEntity.appearance.turretMatrix, turretOffset)
            # gunMP = mathUtils.MatrixProviders.product(vEntity.appearance.gunMatrix, gunOffset)
        # Getting full transform matrices relative to vehicle coordinate system
            self.modifiedModelsDesc[TankPartNames.TURRET if not idx else '%s%d' % (TankPartNames.ADDITIONAL_TURRET, idx)][
                'matrix'] = fullTurretMP = mathUtils.MatrixProviders.product(turretMP, fullHullMP)
            self.modifiedModelsDesc[TankPartNames.GUN if not idx else '%s%d' % (TankPartNames.ADDITIONAL_GUN, idx)][
                'matrix'] = mathUtils.MatrixProviders.product(gunMP, fullTurretMP)
        for moduleName, moduleDict in self.modifiedModelsDesc.items():
            motor = BigWorld.Servo(mathUtils.MatrixProviders.product(moduleDict['matrix'], vEntity.matrix))
            moduleDict['model'].addMotor(motor)
            if moduleDict['model'] not in tuple(vEntity.models):
                try:
                    vEntity.addModel(moduleDict['model'])
                except StandardError:
                    pass
            moduleDict['model'].visible = True
        addCollisionGUI(self)
    if g_config.data['collisionEnabled']:
        for moduleName in TankPartNames.ALL:
            if compoundModel.node(moduleName) is not None:
                scaleMat = Math.Matrix()
                scaleMat.setScale((0.001, 0.001, 0.001))
                compoundModel.node(moduleName, scaleMat)
            else:
                print 'RemodEnabler: model rescale for %s failed' % moduleName
Ejemplo n.º 36
0
def new_setupModel(base, self, buildIdx):
    base(self, buildIdx)
    if not g_config.data['enabled']:
        return
    if g_config.collisionMode:
        vEntity = self._HangarVehicleAppearance__vEntity
        vDesc = self._HangarVehicleAppearance__vDesc
        compoundModel = vEntity.model
        self.collisionLoaded = True
        self.modifiedModelsDesc = {}
        failList = []
        for partName in TankPartNames.ALL:
            modelName = ''
            try:
                modelName = getattr(vDesc, partName).hitTester.bspModelName
                model = BigWorld.Model(modelName)
                model.visible = False
                self.modifiedModelsDesc[partName] = {
                    'model': model,
                    'matrix': None
                }
            except StandardError:
                self.collisionLoaded = False
                failList.append(modelName if modelName else partName)
        if failList:
            print g_config.ID + ': collision load failed: models not found', failList
        if not self.collisionLoaded:
            return
        # Getting offset matrices
        hullOffset = mathUtils.createTranslationMatrix(
            vDesc.chassis.hullPosition)
        self.modifiedModelsDesc[TankPartNames.CHASSIS][
            'matrix'] = fullChassisMP = mathUtils.createIdentityMatrix()
        hullMP = mathUtils.MatrixProviders.product(
            mathUtils.createIdentityMatrix(), hullOffset)
        self.modifiedModelsDesc[TankPartNames.HULL][
            'matrix'] = fullHullMP = mathUtils.MatrixProviders.product(
                hullMP, fullChassisMP)
        for idx in xrange(len(vDesc.hull.turretPositions)):
            if idx:
                print g_config.ID + ': WARNING: multiple turrets are present!', vDesc.name
                break
            turretOffset = mathUtils.createTranslationMatrix(
                vDesc.hull.turretPositions[idx])
            gunOffset = mathUtils.createTranslationMatrix(
                vDesc.turret.gunPosition)
            # Getting local transform matrices
            turretMP = mathUtils.MatrixProviders.product(
                mathUtils.createIdentityMatrix(), turretOffset)
            gunMP = mathUtils.MatrixProviders.product(
                mathUtils.createIdentityMatrix(), gunOffset)
            # turretMP = mathUtils.MatrixProviders.product(vEntity.appearance.turretMatrix, turretOffset)
            # gunMP = mathUtils.MatrixProviders.product(vEntity.appearance.gunMatrix, gunOffset)
            # Getting full transform matrices relative to vehicle coordinate system
            self.modifiedModelsDesc[TankPartNames.TURRET][
                'matrix'] = fullTurretMP = mathUtils.MatrixProviders.product(
                    turretMP, fullHullMP)
            self.modifiedModelsDesc[TankPartNames.GUN][
                'matrix'] = mathUtils.MatrixProviders.product(
                    gunMP, fullTurretMP)
        for moduleDict in self.modifiedModelsDesc.itervalues():
            motor = BigWorld.Servo(
                mathUtils.MatrixProviders.product(moduleDict['matrix'],
                                                  vEntity.matrix))
            moduleDict['model'].addMotor(motor)
            if moduleDict['model'] not in tuple(vEntity.models):
                try:
                    vEntity.addModel(moduleDict['model'])
                except StandardError:
                    pass
            moduleDict['model'].visible = True
        addCollisionGUI(self)
    if g_config.collisionMode == 1:
        for moduleName in TankPartNames.ALL:
            # noinspection PyUnboundLocalVariable
            if compoundModel.node(moduleName) is not None:
                scaleMat = Math.Matrix()
                scaleMat.setScale((0.001, 0.001, 0.001))
                compoundModel.node(moduleName, scaleMat)
            else:
                print g_config.ID + ': model rescale for', moduleName, 'failed'
Ejemplo n.º 37
0
 def __relinkToIdentity(self):
     self.__outputMProv.rotationSrc = mathUtils.createIdentityMatrix()
     self.__outputMProv.translationSrc = self.__outputMProv.rotationSrc
     self.__stabilisedMProv.target = self.__outputMProv.rotationSrc