don't include rotation in baseline if smallest-three compression

This commit is contained in:
mischa 2024-09-19 21:06:07 +02:00
parent 2de68feb5e
commit 1bfb469821

View File

@ -207,10 +207,10 @@ public override void OnSerialize(NetworkWriter writer, bool initialState)
if (syncPosition) writer.WriteVector3(snapshot.position); if (syncPosition) writer.WriteVector3(snapshot.position);
if (syncRotation) if (syncRotation)
{ {
// (optional) smallest three compression for now. no delta. // if smallest-three quaternion compression is enabled,
if (compressRotation) // then we don't need baseline rotation since delta always
writer.WriteUInt(Compression.CompressQuaternion(snapshot.rotation)); // sends an absolute value.
else if (!compressRotation)
writer.WriteQuaternion(snapshot.rotation); writer.WriteQuaternion(snapshot.rotation);
} }
if (syncScale) writer.WriteVector3(snapshot.scale); if (syncScale) writer.WriteVector3(snapshot.scale);
@ -271,10 +271,10 @@ public override void OnDeserialize(NetworkReader reader, bool initialState)
} }
if (syncRotation) if (syncRotation)
{ {
// (optional) smallest three compression for now. no delta. // if smallest-three quaternion compression is enabled,
if (compressRotation) // then we don't need baseline rotation since delta always
rotation = Compression.DecompressQuaternion(reader.ReadUInt()); // sends an absolute value.
else if (!compressRotation)
rotation = reader.ReadQuaternion(); rotation = reader.ReadQuaternion();
} }
if (syncScale) scale = reader.ReadVector3(); if (syncScale) scale = reader.ReadVector3();