diff --git a/Engine/source/T3D/rigidShape.cpp b/Engine/source/T3D/rigidShape.cpp index eba9f4bf7..f969b76e6 100644 --- a/Engine/source/T3D/rigidShape.cpp +++ b/Engine/source/T3D/rigidShape.cpp @@ -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(); } diff --git a/Engine/source/T3D/vehicles/vehicle.cpp b/Engine/source/T3D/vehicles/vehicle.cpp index 82e7d09d4..27d1ef922 100644 --- a/Engine/source/T3D/vehicles/vehicle.cpp +++ b/Engine/source/T3D/vehicles/vehicle.cpp @@ -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(); }