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

Method setVelocity

Engine/source/T3D/item.cpp:508–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

506}
507
508void Item::setVelocity(const VectorF& vel)
509{
510 mVelocity = vel;
511
512 // Clamp against the maximum velocity.
513 if ( mDataBlock->maxVelocity > 0 )
514 {
515 F32 len = mVelocity.magnitudeSafe();
516 if ( len > mDataBlock->maxVelocity )
517 {
518 Point3F excess = mVelocity * ( 1.0f - (mDataBlock->maxVelocity / len ) );
519 mVelocity -= excess;
520 }
521 }
522
523 setMaskBits(PositionMask);
524 mAtRest = false;
525 mAtRestCounter = 0;
526}
527
528void Item::applyImpulse(const Point3F&,const VectorF& vec)
529{

Callers 8

updateSoundMethod · 0.45
updateSoundMethod · 0.45
updatePosMethod · 0.45
_updateMethod · 0.45
updateEngineSoundMethod · 0.45
updateEngineSoundMethod · 0.45
updateJetMethod · 0.45
updateFrothMethod · 0.45

Calls 1

magnitudeSafeMethod · 0.45

Tested by

no test coverage detected