cleanups for disablemove

downshift the exposure of the entry to rigidshape so it and vehicles all have the button.
fix moving them after they've become atrest failing to apply gravity untill collided with or applyimpulse is called on them
de-duplicate vehicle networking in reguards to rigid body instance variable transmission
This commit is contained in:
AzaezelX 2023-09-22 19:02:26 -05:00
parent e1cc9136d0
commit 0c97732ae9
2 changed files with 9 additions and 30 deletions

View file

@ -1103,7 +1103,7 @@ void RigidShape::updatePos(F32 dt)
// Update collision information based on our current pos.
bool collided = false;
if (!mRigid.atRest && !mDisableMove)
if (!mDisableMove)
{
collided = updateCollision(dt);
@ -1224,7 +1224,7 @@ void RigidShape::updateForces(F32 dt)
mRigid.torque = torque;
// If we're still atRest, make sure we're not accumulating anything
if (mRigid.atRest)
if ((force.lenSquared() < mDataBlock->contactTol)&& (force.lenSquared() < mDataBlock->contactTol))
mRigid.setAtRest();
}
@ -1239,7 +1239,11 @@ bool RigidShape::updateCollision(F32 dt)
{
PROFILE_SCOPE(RigidShape_updateCollision);
if (mRigid.atRest || mDisableMove || (getVelocity().lenSquared() < mDataBlock->contactTol * mDataBlock->contactTol)) return false;
if (mDisableMove)
{
mRigid.setAtRest();
return false;
}
// Update collision information
MatrixF mat,cmat;
@ -1687,6 +1691,8 @@ void RigidShape::consoleInit()
void RigidShape::initPersistFields()
{
docsURL;
addField("disableMove", TypeBool, Offset(mDisableMove, RigidShape),
"When this flag is set, the vehicle will ignore throttle changes.");
Parent::initPersistFields();
}