Now projectiles wont explode before they have been armed. Results in projectiles being able to collide with several objects before exploding.

This commit is contained in:
Lukas Joergensen 2013-05-15 21:13:52 +02:00
parent 66775714ef
commit 9bdeabf22c

View file

@ -1106,9 +1106,6 @@ void Projectile::simulate( F32 dt )
if ( isServerObject() && ( rInfo.object->getTypeMask() & csmStaticCollisionMask ) == 0 ) if ( isServerObject() && ( rInfo.object->getTypeMask() & csmStaticCollisionMask ) == 0 )
setMaskBits( BounceMask ); setMaskBits( BounceMask );
// Next order of business: do we explode on this hit?
if ( mCurrTick > mDataBlock->armingDelay || mDataBlock->armingDelay == 0 )
{
MatrixF xform( true ); MatrixF xform( true );
xform.setColumn( 3, rInfo.point ); xform.setColumn( 3, rInfo.point );
setTransform( xform ); setTransform( xform );
@ -1142,13 +1139,10 @@ void Projectile::simulate( F32 dt )
// onCollision will remain uncalled on the client however, therefore no client // onCollision will remain uncalled on the client however, therefore no client
// specific code should be placed inside the function! // specific code should be placed inside the function!
onCollision( rInfo.point, rInfo.normal, rInfo.object ); onCollision( rInfo.point, rInfo.normal, rInfo.object );
// Next order of business: do we explode on this hit?
if ( mCurrTick > mDataBlock->armingDelay || mDataBlock->armingDelay == 0 )
explode( rInfo.point, rInfo.normal, objectType ); explode( rInfo.point, rInfo.normal, objectType );
// break out of the collision check, since we've exploded
// we don't want to mess with the position and velocity
}
else
{
if ( mDataBlock->isBallistic ) if ( mDataBlock->isBallistic )
{ {
// Otherwise, this represents a bounce. First, reflect our velocity // Otherwise, this represents a bounce. First, reflect our velocity
@ -1169,7 +1163,6 @@ void Projectile::simulate( F32 dt )
newPosition = oldPosition = rInfo.point + rInfo.normal * 0.05f; newPosition = oldPosition = rInfo.point + rInfo.normal * 0.05f;
} }
} }
}
// re-enable the collision response on the source object now // re-enable the collision response on the source object now
// that we are done processing the ballistic movement // that we are done processing the ballistic movement