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