Cache wheel physical object

This commit is contained in:
Dmitry Tsarevich 2023-10-10 21:00:59 +03:00
parent 2e4e37be8a
commit 79b2b14d2f
No known key found for this signature in database
GPG Key ID: 3852365567163251
1 changed files with 4 additions and 3 deletions

View File

@ -320,11 +320,12 @@ void JoltPhysicsVehicleController::OnPostSimulate( float flDeltaTime )
// what to do about that?..
// We just want the local rotation, and this seems to work (?)
QAngle newQuat = JoltToSource::Angle( wheelTransform.GetQuaternion() );
m_Wheels[ w ].pObject->EnableCollisions( false );
JoltPhysicsObject* object = m_Wheels[w].pObject;
object->EnableCollisions( false );
// Set dummy wheel object pos/angles so the game code can update pose positions for wheels.
m_Wheels[ w ].pObject->SetPosition( newPos, newQuat, true );
object->SetPosition( newPos, newQuat, true );
// Wake it up so that the game bothers to do pose positions.
m_Wheels[ w ].pObject->Wake();
object->Wake();
if ( m_VehicleConstraint->GetWheels()[w]->HasContact() )
m_OperatingParams.wheelsInContact++;