From e3ae0b6304e92e62615d347e178467b4e58fe3ff Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Sat, 19 Aug 2023 23:17:12 -0700 Subject: [PATCH] fix frame stats in vehicle racing --- dGame/dComponents/VehiclePhysicsComponent.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/dGame/dComponents/VehiclePhysicsComponent.cpp b/dGame/dComponents/VehiclePhysicsComponent.cpp index 79b6cc82..2a001e71 100644 --- a/dGame/dComponents/VehiclePhysicsComponent.cpp +++ b/dGame/dComponents/VehiclePhysicsComponent.cpp @@ -89,22 +89,21 @@ void VehiclePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bI outBitStream->Write(m_IsOnGround); 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.y); outBitStream->Write(m_Velocity.z); - m_DirtyVelocity = false; } - outBitStream->Write(bIsInitialUpdate || m_DirtyAngularVelocity); - - if (bIsInitialUpdate || m_DirtyAngularVelocity) { + bool isAngularVelocityZero = m_AngularVelocity == NiPoint3::ZERO; + outBitStream->Write(isAngularVelocityZero); + if (isAngularVelocityZero) { outBitStream->Write(m_AngularVelocity.x); outBitStream->Write(m_AngularVelocity.y); outBitStream->Write(m_AngularVelocity.z); - m_DirtyAngularVelocity = false; } outBitStream->Write0(); // local_space_info. TODO: Implement this