فهرست منبع

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

AzaezelX 2 سال پیش
والد
کامیت
0c97732ae9
2فایلهای تغییر یافته به همراه9 افزوده شده و 30 حذف شده
  1. 9 3
      Engine/source/T3D/rigidShape.cpp
  2. 0 27
      Engine/source/T3D/vehicles/vehicle.cpp

+ 9 - 3
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();
 }
 

+ 0 - 27
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();
 }