def notifyAboutCollision(self, energy, collisionPoint, effectMaterialIdx, groundEffect, underWater): if groundEffect: stages, effectsList, _ = self.__detachmentEffectsDesc['collision'][effectMaterialIdx] normalizedEnergy = self.__normalizeEnergy(energy) dropEnergyParam = SoundStartParam(_TurretDetachmentEffects._DROP_ENERGY_PARAM, normalizedEnergy) BigWorld.player().terrainEffects.addNew(collisionPoint, effectsList, stages, None, soundParams=[dropEnergyParam]) if self.__state != self.State.ON_GROUND: self.__state = self.State.ON_GROUND if not underWater: self.__playStateEffect() return
def showCollisionEffect(self, hitPos, collisionEffectName='collisionVehicle', collisionNormal=None, isTracks=False, damageFactor=0, impulse=None, pcEnergy=None): invWorldMatrix = Math.Matrix(self.matrix) invWorldMatrix.invert() rot = Math.Matrix() if collisionNormal is None: rot.setRotateYPR( (random.uniform(-3.14, 3.14), random.uniform(-1.5, 1.5), 0.0)) else: rot.setRotateYPR((0, 0, 0)) mat = Math.Matrix() mat.setTranslate(hitPos) mat.preMultiply(rot) mat.postMultiply(invWorldMatrix) if pcEnergy is not None: collisionEnergy = [ SoundStartParam('RTPC_ext_collision_impulse_tank', pcEnergy) ] else: collisionEnergy = [] effectsList = self.typeDescriptor.type.effects.get( collisionEffectName, []) if effectsList: keyPoints, effects, _ = random.choice(effectsList) self.appearance.boundEffects.addNewToNode( TankPartNames.HULL, mat, effects, keyPoints, entity=self, surfaceNormal=collisionNormal, isTracks=isTracks, impulse=impulse, damageFactor=damageFactor, hitPoint=hitPos, soundParams=collisionEnergy) return