2023-10-09 20:19:38 +00:00
|
|
|
#include "PhysicsComponent.h"
|
|
|
|
|
|
|
|
PhysicsComponent::PhysicsComponent(Entity* parent) : Component(parent) {
|
2024-01-29 07:53:12 +00:00
|
|
|
m_Position = NiPoint3Constant::ZERO;
|
|
|
|
m_Rotation = NiQuaternionConstant::IDENTITY;
|
2023-10-09 20:19:38 +00:00
|
|
|
m_DirtyPosition = false;
|
|
|
|
}
|
|
|
|
|
2024-02-27 07:25:44 +00:00
|
|
|
void PhysicsComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) {
|
|
|
|
outBitStream.Write(bIsInitialUpdate || m_DirtyPosition);
|
2023-10-09 20:19:38 +00:00
|
|
|
if (bIsInitialUpdate || m_DirtyPosition) {
|
2024-02-27 07:25:44 +00:00
|
|
|
outBitStream.Write(m_Position.x);
|
|
|
|
outBitStream.Write(m_Position.y);
|
|
|
|
outBitStream.Write(m_Position.z);
|
|
|
|
outBitStream.Write(m_Rotation.x);
|
|
|
|
outBitStream.Write(m_Rotation.y);
|
|
|
|
outBitStream.Write(m_Rotation.z);
|
|
|
|
outBitStream.Write(m_Rotation.w);
|
2023-10-09 20:19:38 +00:00
|
|
|
if (!bIsInitialUpdate) m_DirtyPosition = false;
|
|
|
|
}
|
|
|
|
}
|