mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
Fix for ballistic projectiles not bouncing
Ballistic projectiles are no longer bouncing when they collide, assuming they have the correct properties set. These changes move the point that a projectile's velocity is zeroed during a collision to fix this.
This commit is contained in:
parent
d5beea41c8
commit
ba81917392
1 changed files with 7 additions and 1 deletions
|
|
@ -1110,7 +1110,6 @@ void Projectile::simulate( F32 dt )
|
||||||
xform.setColumn( 3, rInfo.point );
|
xform.setColumn( 3, rInfo.point );
|
||||||
setTransform( xform );
|
setTransform( xform );
|
||||||
mCurrPosition = rInfo.point;
|
mCurrPosition = rInfo.point;
|
||||||
mCurrVelocity = Point3F::Zero;
|
|
||||||
|
|
||||||
// Get the object type before the onCollision call, in case
|
// Get the object type before the onCollision call, in case
|
||||||
// the object is destroyed.
|
// the object is destroyed.
|
||||||
|
|
@ -1141,7 +1140,10 @@ void Projectile::simulate( F32 dt )
|
||||||
onCollision( rInfo.point, rInfo.normal, rInfo.object );
|
onCollision( rInfo.point, rInfo.normal, rInfo.object );
|
||||||
// Next order of business: do we explode on this hit?
|
// Next order of business: do we explode on this hit?
|
||||||
if ( mCurrTick > mDataBlock->armingDelay || mDataBlock->armingDelay == 0 )
|
if ( mCurrTick > mDataBlock->armingDelay || mDataBlock->armingDelay == 0 )
|
||||||
|
{
|
||||||
|
mCurrVelocity = Point3F::Zero;
|
||||||
explode( rInfo.point, rInfo.normal, objectType );
|
explode( rInfo.point, rInfo.normal, objectType );
|
||||||
|
}
|
||||||
|
|
||||||
if ( mDataBlock->isBallistic )
|
if ( mDataBlock->isBallistic )
|
||||||
{
|
{
|
||||||
|
|
@ -1162,6 +1164,10 @@ void Projectile::simulate( F32 dt )
|
||||||
//F32 timeLeft = 1.0f - rInfo.t;
|
//F32 timeLeft = 1.0f - rInfo.t;
|
||||||
newPosition = oldPosition = rInfo.point + rInfo.normal * 0.05f;
|
newPosition = oldPosition = rInfo.point + rInfo.normal * 0.05f;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mCurrVelocity = Point3F::Zero;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// re-enable the collision response on the source object now
|
// re-enable the collision response on the source object now
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue