Exemple #1
0
 def onStaticCollision(self, energy, point, normal, miscFlags, damageHull,
                       damageLeftTrack, damageRightTrack, destrEffectIdx,
                       matKind):
     if not self.isStarted:
         return
     self.appearance.stopSwinging()
     BigWorld.player().inputHandler.onVehicleCollision(
         self, self.getSpeed())
     isTrackCollision = bool(miscFlags & 1)
     isSptCollision = bool(miscFlags >> 1 & 1)
     isSptDestroyed = bool(miscFlags >> 2 & 1)
     if isSptDestroyed:
         return
     hitPoint = point
     surfNormal = normal
     matKind = SPT_MATKIND.SOLID
     if destrEffectIdx < 0:
         if isTrackCollision:
             damageFactor = damageLeftTrack if damageLeftTrack > damageRightTrack else damageRightTrack
         else:
             damageFactor = damageHull
         if not isSptCollision:
             surfaceMaterial = calcSurfaceMaterialNearPoint(
                 hitPoint, normal, self.spaceID)
             hitPoint, surfNormal, matKind, effectIdx = surfaceMaterial
         else:
             effectIdx = EFFECT_MATERIAL_INDEXES_BY_NAMES['wood']
         if matKind != 0:
             self.__showStaticCollisionEffect(energy, matKind, effectIdx,
                                              hitPoint, surfNormal,
                                              isTrackCollision,
                                              damageFactor * 100.0)
     if self.isPlayerVehicle:
         self.appearance.executeRammingVibrations(matKind)
 def __checkIsBeingPulled(self):
     if self.__detachmentEffects is not None:
         if self.isCollidingWithWorld and not self.isUnderWater and self.velocity.lengthSquared > 0.1:
             extent = Math.Matrix(self.model.bounds).applyVector(Math.Vector3(0.5, 0.5, 0.5)).length
             surfaceMaterial = calcSurfaceMaterialNearPoint(self.position, Math.Vector3(0, extent, 0), self.spaceID)
             self.__detachmentEffects.notifyAboutBeingPulled(True, surfaceMaterial.effectIdx)
             if surfaceMaterial.matKind == 0:
                 LOG_ERROR('calcSurfaceMaterialNearPoint failed to find the collision point')
         else:
             self.__detachmentEffects.notifyAboutBeingPulled(False, None)
     return SERVER_TICK_LENGTH
Exemple #3
0
 def __checkIsBeingPulled(self):
     if self.__detachmentEffects is not None:
         if self.isCollidingWithWorld and not self.isUnderWater and self.velocity.lengthSquared > 0.1:
             extent = Math.Matrix(self.model.getBoundsForRoot()).applyVector(Math.Vector3(0.5, 0.5, 0.5)).length
             surfaceMaterial = calcSurfaceMaterialNearPoint(self.position, Math.Vector3(0, extent, 0), self.spaceID)
             self.__detachmentEffects.notifyAboutBeingPulled(True, surfaceMaterial.effectIdx)
             if surfaceMaterial.matKind == 0:
                 LOG_ERROR('calcSurfaceMaterialNearPoint failed to find the collision point')
         else:
             self.__detachmentEffects.notifyAboutBeingPulled(False, None)
     return SERVER_TICK_LENGTH
Exemple #4
0
 def onStaticCollision(self, energy, point, normal):
     if self.__detachmentEffects is not None:
         surfaceMaterial = calcSurfaceMaterialNearPoint(point, normal, self.spaceID)
         effectIdx = surfaceMaterial.effectIdx
         groundEffect = True
         distToWater = BigWorld.wg_collideWater(self.position, surfaceMaterial.point)
         if distToWater != -1:
             vel = Math.Vector3(self.velocity).length
             if vel < _MIN_COLLISION_SPEED:
                 groundEffect = False
             effectIdx = material_kinds.EFFECT_MATERIAL_INDEXES_BY_NAMES['water']
         self.__detachmentEffects.notifyAboutCollision(energy, point, effectIdx, groundEffect, self.isUnderWater)
Exemple #5
0
 def onStaticCollision(self, energy, point, normal):
     if self.__detachmentEffects is not None:
         surfaceMaterial = calcSurfaceMaterialNearPoint(point, normal, self.spaceID)
         effectIdx = surfaceMaterial.effectIdx
         groundEffect = True
         distToWater = BigWorld.wg_collideWater(self.position, surfaceMaterial.point)
         if distToWater != -1:
             vel = Math.Vector3(self.velocity).length
             if vel < _MIN_COLLISION_SPEED:
                 groundEffect = False
             effectIdx = material_kinds.EFFECT_MATERIAL_INDEXES_BY_NAMES['water']
         self.__detachmentEffects.notifyAboutCollision(energy, point, effectIdx, groundEffect, self.isUnderWater)
     return
Exemple #6
0
 def onStaticCollision(self, energy, point, normal, miscFlags):
     if not self.isStarted:
         return 
     self.appearance.stopSwinging()
     BigWorld.player().inputHandler.onVehicleCollision(self, self.getSpeed())
     isTrackCollision = bool(miscFlags & 1)
     isSptCollision = bool(miscFlags >> 1 & 1)
     isSptDestroyed = bool(miscFlags >> 2 & 1)
     hitPoint = point
     surfNormal = normal
     if not isSptCollision:
         surfaceMaterial = calcSurfaceMaterialNearPoint(point, normal, self.spaceID)
         (hitPoint, surfNormal, matKind, effectIdx,) = surfaceMaterial
     elif isSptDestroyed:
         return 
     hitPoint = point
     matKind = SPT_MATKIND.SOLID
     effectIdx = EFFECT_MATERIAL_INDEXES_BY_NAMES['wood']
     self.__showStaticCollisionEffect(energy, matKind, effectIdx, hitPoint, surfNormal, isTrackCollision)
Exemple #7
0
 def onStaticCollision(self, energy, point, normal, miscFlags, damageHull, damageLeftTrack, damageRightTrack):
     if not self.isStarted:
         return
     self.appearance.stopSwinging()
     BigWorld.player().inputHandler.onVehicleCollision(self, self.getSpeed())
     isTrackCollision = bool(miscFlags & 1)
     isSptCollision = bool(miscFlags >> 1 & 1)
     isSptDestroyed = bool(miscFlags >> 2 & 1)
     hitPoint = point + self.position if isTrackCollision else point
     surfNormal = normal
     if not isSptCollision:
         surfaceMaterial = calcSurfaceMaterialNearPoint(hitPoint, normal, self.spaceID)
         hitPoint, surfNormal, matKind, effectIdx = surfaceMaterial
     else:
         if isSptDestroyed:
             return
         matKind = SPT_MATKIND.SOLID
         effectIdx = EFFECT_MATERIAL_INDEXES_BY_NAMES['wood']
     if isTrackCollision:
         damageFactor = damageLeftTrack if damageLeftTrack > damageRightTrack else damageRightTrack
     else:
         damageFactor = damageHull
     self.__showStaticCollisionEffect(energy, matKind, effectIdx, hitPoint, surfNormal, isTrackCollision, damageFactor * 100.0)
Exemple #8
0
 def onStaticCollision(self, energy, point, normal, miscFlags):
     if not self.isStarted:
         return
     self.appearance.stopSwinging()
     BigWorld.player().inputHandler.onVehicleCollision(
         self, self.getSpeed())
     isTrackCollision = bool(miscFlags & 1)
     isSptCollision = bool(miscFlags >> 1 & 1)
     isSptDestroyed = bool(miscFlags >> 2 & 1)
     hitPoint = point
     surfNormal = normal
     if not isSptCollision:
         surfaceMaterial = calcSurfaceMaterialNearPoint(
             point, normal, self.spaceID)
         hitPoint, surfNormal, matKind, effectIdx = surfaceMaterial
     else:
         if isSptDestroyed:
             return
         hitPoint = point
         matKind = SPT_MATKIND.SOLID
         effectIdx = EFFECT_MATERIAL_INDEXES_BY_NAMES['wood']
     self.__showStaticCollisionEffect(energy, matKind, effectIdx, hitPoint,
                                      surfNormal, isTrackCollision)