mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-05 13:30:34 +00:00
code review:
1) got rid of evey class having it's own gravity 2) rigidshape inheritance simplifications 3) gravitymod from physicszones taking buoyancy into account natively (we still track raw bouyancy to cancel it out for player) 4) disableMove used throughout 5) items can now also be influenced by the appliedforce from physicszones
This commit is contained in:
parent
76c5e30869
commit
afb39d398f
13 changed files with 191 additions and 487 deletions
|
|
@ -50,8 +50,6 @@ const S32 sCollisionTimeout = 15; // Timout value in ticks
|
|||
static F32 sMinWarpTicks = 0.5 ; // Fraction of tick at which instant warp occures
|
||||
static S32 sMaxWarpTicks = 3; // Max warp duration in ticks
|
||||
|
||||
F32 Item::mGravity = -20.0f;
|
||||
|
||||
const U32 sClientCollisionMask = (TerrainObjectType |
|
||||
StaticShapeObjectType |
|
||||
VehicleObjectType |
|
||||
|
|
@ -716,18 +714,20 @@ void Item::updateWorkingCollisionSet(const U32 mask, const F32 dt)
|
|||
|
||||
void Item::updateVelocity(const F32 dt)
|
||||
{
|
||||
// Container buoyancy & drag
|
||||
// Acceleration due to gravity
|
||||
mVelocity.z += (mGravity * mDataBlock->gravityMod) * dt;
|
||||
mVelocity.z += (mNetGravity * mDataBlock->gravityMod) * dt;
|
||||
mVelocity -= mVelocity * mDrag * dt;
|
||||
|
||||
// Add in physical zone force
|
||||
mVelocity += mAppliedForce;
|
||||
|
||||
F32 len;
|
||||
if (mDataBlock->maxVelocity > 0 && (len = mVelocity.len()) > (mDataBlock->maxVelocity * 1.05)) {
|
||||
Point3F excess = mVelocity * (1.0 - (mDataBlock->maxVelocity / len ));
|
||||
excess *= 0.1f;
|
||||
mVelocity -= excess;
|
||||
}
|
||||
|
||||
// Container buoyancy & drag
|
||||
mVelocity.z -= mBuoyancy * (mGravity * mDataBlock->gravityMod * mGravityMod) * dt;
|
||||
mVelocity -= mVelocity * mDrag * dt;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue