nthybrid: debug draw data points

This commit is contained in:
miwarnec 2024-11-04 10:35:15 +01:00
parent 2bf6428eaf
commit 707bb87fb6

View File

@ -102,6 +102,7 @@ public class NetworkTransformHybrid2022 : NetworkBehaviour
// debugging /////////////////////////////////////////////////////////// // debugging ///////////////////////////////////////////////////////////
[Header("Debug")] [Header("Debug")]
public bool debugDraw;
public bool showGizmos; public bool showGizmos;
public bool showOverlay; public bool showOverlay;
public Color overlayColor = new Color(0, 0, 0, 0.5f); public Color overlayColor = new Color(0, 0, 0, 0.5f);
@ -213,6 +214,9 @@ void CmdClientToServerBaseline_PositionRotation(byte baselineTick, Vector3 posit
lastDeserializedBaselinePosition = position; lastDeserializedBaselinePosition = position;
lastDeserializedBaselineRotation = rotation; lastDeserializedBaselineRotation = rotation;
// debug draw: baseline
if (debugDraw) Debug.DrawLine(position, position + Vector3.up, Color.yellow, 10f);
// if baseline counts as delta, insert it into snapshot buffer too // if baseline counts as delta, insert it into snapshot buffer too
if (baselineIsDelta) if (baselineIsDelta)
OnClientToServerDeltaSync(baselineTick, position, rotation);//, scale); OnClientToServerDeltaSync(baselineTick, position, rotation);//, scale);
@ -224,6 +228,9 @@ void CmdClientToServerBaseline_Position(byte baselineTick, Vector3 position)
lastDeserializedBaselineTick = baselineTick; lastDeserializedBaselineTick = baselineTick;
lastDeserializedBaselinePosition = position; lastDeserializedBaselinePosition = position;
// debug draw: baseline
if (debugDraw) Debug.DrawLine(position, position + Vector3.up, Color.yellow, 10f);
// if baseline counts as delta, insert it into snapshot buffer too // if baseline counts as delta, insert it into snapshot buffer too
if (baselineIsDelta) if (baselineIsDelta)
OnClientToServerDeltaSync(baselineTick, position, Quaternion.identity);//, scale); OnClientToServerDeltaSync(baselineTick, position, Quaternion.identity);//, scale);
@ -244,6 +251,9 @@ void CmdClientToServerBaseline_Rotation(byte baselineTick, Quaternion rotation)
[Command(channel = Channels.Unreliable)] // unreliable delta [Command(channel = Channels.Unreliable)] // unreliable delta
void CmdClientToServerDelta_Position(byte baselineTick, Vector3 position) void CmdClientToServerDelta_Position(byte baselineTick, Vector3 position)
{ {
// debug draw: delta
if (debugDraw) Debug.DrawLine(position, position + Vector3.up, Color.white, 10f);
// Debug.Log($"[{name}] server received delta for baseline #{lastDeserializedBaselineTick}"); // Debug.Log($"[{name}] server received delta for baseline #{lastDeserializedBaselineTick}");
OnClientToServerDeltaSync(baselineTick, position, Quaternion.identity);//, scale); OnClientToServerDeltaSync(baselineTick, position, Quaternion.identity);//, scale);
} }
@ -258,6 +268,9 @@ void CmdClientToServerDelta_Rotation(byte baselineTick, Quaternion rotation)
[Command(channel = Channels.Unreliable)] // unreliable delta [Command(channel = Channels.Unreliable)] // unreliable delta
void CmdClientToServerDelta_PositionRotation(byte baselineTick, Vector3 position, Quaternion rotation) void CmdClientToServerDelta_PositionRotation(byte baselineTick, Vector3 position, Quaternion rotation)
{ {
// debug draw: delta
if (debugDraw) Debug.DrawLine(position, position + Vector3.up, Color.white, 10f);
// Debug.Log($"[{name}] server received delta for baseline #{lastDeserializedBaselineTick}"); // Debug.Log($"[{name}] server received delta for baseline #{lastDeserializedBaselineTick}");
OnClientToServerDeltaSync(baselineTick, position, rotation);//, scale); OnClientToServerDeltaSync(baselineTick, position, rotation);//, scale);
} }
@ -324,6 +337,9 @@ void RpcServerToClientBaseline_PositionRotation(byte baselineTick, Vector3 posit
lastDeserializedBaselinePosition = position; lastDeserializedBaselinePosition = position;
lastDeserializedBaselineRotation = rotation; lastDeserializedBaselineRotation = rotation;
// debug draw: baseline
if (debugDraw) Debug.DrawLine(position, position + Vector3.up, Color.yellow, 10f);
// if baseline counts as delta, insert it into snapshot buffer too // if baseline counts as delta, insert it into snapshot buffer too
if (baselineIsDelta) if (baselineIsDelta)
OnServerToClientDeltaSync(baselineTick, position, rotation);//, Vector3.zero);//, scale); OnServerToClientDeltaSync(baselineTick, position, rotation);//, Vector3.zero);//, scale);
@ -340,6 +356,9 @@ void RpcServerToClientBaseline_Position(byte baselineTick, Vector3 position)
lastDeserializedBaselineTick = baselineTick; lastDeserializedBaselineTick = baselineTick;
lastDeserializedBaselinePosition = position; lastDeserializedBaselinePosition = position;
// debug draw: baseline
if (debugDraw) Debug.DrawLine(position, position + Vector3.up, Color.yellow, 10f);
// if baseline counts as delta, insert it into snapshot buffer too // if baseline counts as delta, insert it into snapshot buffer too
if (baselineIsDelta) if (baselineIsDelta)
OnServerToClientDeltaSync(baselineTick, position, Quaternion.identity);//, Vector3.zero);//, scale); OnServerToClientDeltaSync(baselineTick, position, Quaternion.identity);//, Vector3.zero);//, scale);
@ -369,6 +388,9 @@ void RpcServerToClientDelta_PositionRotation(byte baselineTick, Vector3 position
// ignore if this object is owned by this client. // ignore if this object is owned by this client.
if (IsClientWithAuthority) return; if (IsClientWithAuthority) return;
// debug draw: delta
if (debugDraw) Debug.DrawLine(position, position + Vector3.up, Color.white, 10f);
OnServerToClientDeltaSync(baselineTick, position, rotation);//, scale); OnServerToClientDeltaSync(baselineTick, position, rotation);//, scale);
} }
@ -380,6 +402,9 @@ void RpcServerToClientDelta_Position(byte baselineTick, Vector3 position)
// ignore if this object is owned by this client. // ignore if this object is owned by this client.
if (IsClientWithAuthority) return; if (IsClientWithAuthority) return;
// debug draw: delta
if (debugDraw) Debug.DrawLine(position, position + Vector3.up, Color.white, 10f);
OnServerToClientDeltaSync(baselineTick, position, Quaternion.identity);//, scale); OnServerToClientDeltaSync(baselineTick, position, Quaternion.identity);//, scale);
} }