| 1204 | //---------------------------------------------------------------------------- |
| 1205 | |
| 1206 | void 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 | //----------------------------------------------------------------------------- |