瀏覽代碼

Merge pull request #539 from DavidWyand-GG/ProjectileFix

Fix for ballistic projectiles not bouncing
David Wyand 11 年之前
父節點
當前提交
65099897f4
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      Engine/source/T3D/projectile.cpp

+ 7 - 1
Engine/source/T3D/projectile.cpp

@@ -1110,7 +1110,6 @@ void Projectile::simulate( F32 dt )
       xform.setColumn( 3, rInfo.point );
       setTransform( xform );
       mCurrPosition    = rInfo.point;
-      mCurrVelocity    = Point3F::Zero;
 
       // Get the object type before the onCollision call, in case
       // the object is destroyed.
@@ -1141,7 +1140,10 @@ void Projectile::simulate( F32 dt )
       onCollision( rInfo.point, rInfo.normal, rInfo.object );
       // Next order of business: do we explode on this hit?
       if ( mCurrTick > mDataBlock->armingDelay || mDataBlock->armingDelay == 0 )
+      {
+         mCurrVelocity    = Point3F::Zero;
          explode( rInfo.point, rInfo.normal, objectType );
+      }
 
       if ( mDataBlock->isBallistic )
       {
@@ -1162,6 +1164,10 @@ void Projectile::simulate( F32 dt )
          //F32 timeLeft = 1.0f - rInfo.t;
          newPosition = oldPosition = rInfo.point + rInfo.normal * 0.05f;
       }
+      else
+      {
+         mCurrVelocity    = Point3F::Zero;
+      }
    }
 
    // re-enable the collision response on the source object now