MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / advanceTime

Method advanceTime

Engine/source/T3D/debris.cpp:772–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

770}
771
772void Debris::advanceTime( F32 dt )
773{
774 mElapsedTime += dt;
775
776 mLifetime -= dt;
777 if( mLifetime <= 0.0 )
778 {
779 mLifetime = 0.0;
780 return;
781 }
782
783 mLastPos = getPosition();
784
785 if( !mStatic )
786 {
787 rotate( dt );
788
789 Point3F nextPos = getPosition();
790 computeNewState( nextPos, mVelocity, dt );
791
792 if( bounce( nextPos, dt ) )
793 {
794 --mNumBounces;
795 if( mNumBounces <= 0 )
796 {
797 if( mDataBlock->explodeOnMaxBounce )
798 {
799 explode();
800 mLifetime = 0.0;
801 }
802 if( mDataBlock->snapOnMaxBounce )
803 {
804 // orient debris so it's flat
805 MatrixF stat = getTransform();
806
807 Point3F dir;
808 stat.getColumn( 1, &dir );
809 dir.z = 0.0;
810
811 MatrixF newTrans = MathUtils::createOrientFromDir( dir );
812
813 // hack for shell casings to get them above ground. Need something better - bramage
814 newTrans.setPosition( getPosition() + Point3F( 0.0f, 0.0f, 0.10f ) );
815
816 setTransform( newTrans );
817 }
818 if( mDataBlock->staticOnMaxBounce )
819 {
820 mStatic = true;
821 }
822 }
823 }
824 else
825 {
826 setPosition( nextPos );
827 }
828 }
829

Callers

nothing calls this directly

Calls 7

getPositionFunction · 0.85
rotateFunction · 0.85
createOrientFromDirFunction · 0.85
getColumnMethod · 0.80
Point3FClass · 0.50
setPositionFunction · 0.50
setPositionMethod · 0.45

Tested by

no test coverage detected