mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-26 18:13:47 +00:00
Merge pull request #1096 from Azaezel/alpha41/aRigidScrubbing
cleanups for disablemove
This commit is contained in:
commit
f405666cbc
2 changed files with 9 additions and 30 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -931,36 +931,12 @@ void Vehicle::writePacketData(GameConnection *connection, BitStream *stream)
|
|||
{
|
||||
Parent::writePacketData(connection, stream);
|
||||
mathWrite(*stream, mSteering);
|
||||
|
||||
mathWrite(*stream, mRigid.linPosition);
|
||||
mathWrite(*stream, mRigid.angPosition);
|
||||
mathWrite(*stream, mRigid.linMomentum);
|
||||
mathWrite(*stream, mRigid.angMomentum);
|
||||
stream->writeFlag(mRigid.atRest);
|
||||
stream->writeFlag(mContacts.getCount() == 0);
|
||||
|
||||
stream->writeFlag(mDisableMove);
|
||||
stream->setCompressionPoint(mRigid.linPosition);
|
||||
}
|
||||
|
||||
void Vehicle::readPacketData(GameConnection *connection, BitStream *stream)
|
||||
{
|
||||
Parent::readPacketData(connection, stream);
|
||||
mathRead(*stream, &mSteering);
|
||||
|
||||
mathRead(*stream, &mRigid.linPosition);
|
||||
mathRead(*stream, &mRigid.angPosition);
|
||||
mathRead(*stream, &mRigid.linMomentum);
|
||||
mathRead(*stream, &mRigid.angMomentum);
|
||||
mRigid.atRest = stream->readFlag();
|
||||
if (stream->readFlag())
|
||||
mContacts.clear();
|
||||
mRigid.updateInertialTensor();
|
||||
mRigid.updateVelocity();
|
||||
mRigid.updateCenterOfMass();
|
||||
|
||||
mDisableMove = stream->readFlag();
|
||||
stream->setCompressionPoint(mRigid.linPosition);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1110,9 +1086,6 @@ void Vehicle::consoleInit()
|
|||
void Vehicle::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
addField( "disableMove", TypeBool, Offset(mDisableMove, Vehicle),
|
||||
"When this flag is set, the vehicle will ignore throttle changes." );
|
||||
|
||||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue