fix frame stats in vehicle racing

This commit is contained in:
David Markowitz 2023-08-19 23:17:12 -07:00
parent a9fd7c5e08
commit e3ae0b6304

View File

@ -89,22 +89,21 @@ void VehiclePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bI
outBitStream->Write(m_IsOnGround); outBitStream->Write(m_IsOnGround);
outBitStream->Write(m_IsOnRail); outBitStream->Write(m_IsOnRail);
outBitStream->Write(bIsInitialUpdate || m_DirtyVelocity); bool isVelocityZero = m_Velocity == NiPoint3::ZERO;
if (bIsInitialUpdate || m_DirtyVelocity) { outBitStream->Write(isVelocityZero);
if (isVelocityZero) {
outBitStream->Write(m_Velocity.x); outBitStream->Write(m_Velocity.x);
outBitStream->Write(m_Velocity.y); outBitStream->Write(m_Velocity.y);
outBitStream->Write(m_Velocity.z); outBitStream->Write(m_Velocity.z);
m_DirtyVelocity = false;
} }
outBitStream->Write(bIsInitialUpdate || m_DirtyAngularVelocity); bool isAngularVelocityZero = m_AngularVelocity == NiPoint3::ZERO;
outBitStream->Write(isAngularVelocityZero);
if (bIsInitialUpdate || m_DirtyAngularVelocity) { if (isAngularVelocityZero) {
outBitStream->Write(m_AngularVelocity.x); outBitStream->Write(m_AngularVelocity.x);
outBitStream->Write(m_AngularVelocity.y); outBitStream->Write(m_AngularVelocity.y);
outBitStream->Write(m_AngularVelocity.z); outBitStream->Write(m_AngularVelocity.z);
m_DirtyAngularVelocity = false;
} }
outBitStream->Write0(); // local_space_info. TODO: Implement this outBitStream->Write0(); // local_space_info. TODO: Implement this