Fix vehicle serialization during races (#1122)

* Fix vehicle serialization during races

- Add missing frame stats reading
- correct the inversion of rotation
- correct serialization order
- use proper dirty flags

Tested that racers are no longer sideways on certain vertical slopes and stay in sync throughout the whole race.

* Update ClientPackets.cpp

* Update ClientPackets.cpp

* Update VehiclePhysicsComponent.h
This commit is contained in:
David Markowitz
2023-06-20 07:19:21 -07:00
committed by GitHub
parent 2d31b7e4bb
commit 132d31d3ab
3 changed files with 89 additions and 12 deletions

View File

@@ -5,6 +5,24 @@
#include "Component.h"
#include "eReplicaComponentType.h"
struct RemoteInputInfo {
void operator=(const RemoteInputInfo& other) {
m_RemoteInputX = other.m_RemoteInputX;
m_RemoteInputY = other.m_RemoteInputY;
m_IsPowersliding = other.m_IsPowersliding;
m_IsModified = other.m_IsModified;
}
bool operator==(const RemoteInputInfo& other) {
return m_RemoteInputX == other.m_RemoteInputX && m_RemoteInputY == other.m_RemoteInputY && m_IsPowersliding == other.m_IsPowersliding && m_IsModified == other.m_IsModified;
}
float m_RemoteInputX;
float m_RemoteInputY;
bool m_IsPowersliding;
bool m_IsModified;
};
/**
* Physics component for vehicles.
*/
@@ -94,6 +112,7 @@ public:
void SetDirtyPosition(bool val);
void SetDirtyVelocity(bool val);
void SetDirtyAngularVelocity(bool val);
void SetRemoteInputInfo(const RemoteInputInfo&);
private:
bool m_DirtyPosition;
@@ -110,4 +129,6 @@ private:
float m_SoftUpdate = 0;
uint32_t m_EndBehavior;
RemoteInputInfo m_RemoteInputInfo;
bool m_DirtyRemoteInput;
};