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

Method updateForces

Engine/source/T3D/rigidShape.cpp:1206–1229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1204//----------------------------------------------------------------------------
1205
1206void RigidShape::updateForces(F32 dt)
1207{
1208 if (mDisableMove) return;
1209
1210 Point3F torque(0, 0, 0);
1211 Point3F force(0, 0, mRigid.mass * mNetGravity);
1212
1213 // Apply drag
1214 Point3F vertDrag = mRigid.linVelocity*Point3F(1, 1, mDataBlock->vertFactor);
1215 force -= vertDrag * mDataBlock->dragForce;
1216
1217 // Add in physical zone force
1218 force += mAppliedForce;
1219
1220 force -= mRigid.linVelocity * mDrag;
1221 torque -= mRigid.angMomentum * mDrag;
1222
1223 mRigid.force = force;
1224 mRigid.torque = torque;
1225
1226 // If we're still atRest, make sure we're not accumulating anything
1227 if (mRigid.atRest)
1228 mRigid.setAtRest();
1229}
1230
1231
1232//-----------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 2

setAtRestMethod · 0.80
Point3FClass · 0.50

Tested by

no test coverage detected