mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-21 15:43:45 +00:00
skip transmitting server authorative wheel spin
it's not in itself a force-injection, so we can just use the existing calcs (also. fix the exisitng calcs so slippling is properly cleared) in addition, rigidshaeps shouldn't be trying to resolve collisions with things mounted to them any more than they should self-collide. it's a hard-locked relational association
This commit is contained in:
parent
2af8bf25d5
commit
5ea10f1cfc
2 changed files with 24 additions and 16 deletions
|
|
@ -1253,6 +1253,9 @@ bool RigidShape::updateCollision(F32 dt)
|
|||
mRigid.getTransform(&mat);
|
||||
cmat = mConvex.getTransform();
|
||||
|
||||
SceneObject* mounted;
|
||||
for (mounted = getMountList(); mounted; mounted = mounted->getMountLink())
|
||||
mounted->disableCollision();
|
||||
mCollisionList.clear();
|
||||
CollisionState *state = mConvex.findClosestState(cmat, getScale(), mDataBlock->collisionTol);
|
||||
if (state && state->mDist <= mDataBlock->collisionTol)
|
||||
|
|
@ -1260,9 +1263,12 @@ bool RigidShape::updateCollision(F32 dt)
|
|||
//resolveDisplacement(ns,state,dt);
|
||||
mConvex.getCollisionInfo(cmat, getScale(), &mCollisionList, mDataBlock->collisionTol);
|
||||
}
|
||||
|
||||
// Resolve collisions
|
||||
bool collided = resolveCollision(mRigid,mCollisionList, dt);
|
||||
|
||||
for (mounted = getMountList(); mounted; mounted = mounted->getMountLink())
|
||||
mounted->enableCollision();
|
||||
|
||||
return collided;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -821,7 +821,7 @@ void WheeledVehicle::advanceTime(F32 dt)
|
|||
|
||||
// Stick the wheels to the ground. This is purely so they look
|
||||
// good while the vehicle is being interpolated.
|
||||
//extendWheels();
|
||||
extendWheels(isClientObject());
|
||||
|
||||
// Update wheel angular position and slip, this is a client visual
|
||||
// feature only, it has no affect on the physics.
|
||||
|
|
@ -1201,6 +1201,7 @@ void WheeledVehicle::extendWheels(bool clientHack)
|
|||
wheel->surface.pos = rInfo.point;
|
||||
wheel->surface.material = rInfo.material;
|
||||
wheel->surface.object = rInfo.object;
|
||||
wheel->slipping = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1475,35 +1476,36 @@ void WheeledVehicle::writePacketData(GameConnection *connection, BitStream *stre
|
|||
{
|
||||
Parent::writePacketData(connection, stream);
|
||||
stream->writeFlag(mBraking);
|
||||
|
||||
Wheel* wend = &mWheel[mDataBlock->wheelCount];
|
||||
for (Wheel* wheel = mWheel; wheel < wend; wheel++)
|
||||
{
|
||||
stream->write(wheel->avel);
|
||||
stream->write(wheel->Dy);
|
||||
stream->write(wheel->Dx);
|
||||
stream->writeFlag(wheel->slipping);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void WheeledVehicle::readPacketData(GameConnection *connection, BitStream *stream)
|
||||
{
|
||||
Parent::readPacketData(connection, stream);
|
||||
mBraking = stream->readFlag();
|
||||
|
||||
|
||||
Wheel* wend = &mWheel[mDataBlock->wheelCount];
|
||||
|
||||
for (Wheel* wheel = mWheel; wheel < wend; wheel++)
|
||||
{
|
||||
stream->read(&wheel->avel);
|
||||
stream->read(&wheel->Dy);
|
||||
stream->read(&wheel->Dx);
|
||||
wheel->slipping = stream->readFlag();
|
||||
if (wheel->tire && wheel->spring) {
|
||||
// Update angular position
|
||||
wheel->apos += (wheel->avel) / M_2PI;
|
||||
wheel->apos -= mFloor(wheel->apos);
|
||||
if (wheel->apos < 0)
|
||||
wheel->apos = 1 - wheel->apos;
|
||||
}
|
||||
}
|
||||
|
||||
// Rigid state is transmitted by the parent...
|
||||
setPosition(mRigid.linPosition,mRigid.angPosition);
|
||||
mDelta.pos = mRigid.linPosition;
|
||||
mDelta.rot[1] = mRigid.angPosition;
|
||||
|
||||
// Stick the wheels to the ground. This is purely so they look
|
||||
// good while the vehicle is being interpolated.
|
||||
extendWheels(isClientObject());
|
||||
updateWheelThreads();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue