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 ///////////////////////////////////////////////////////////
[Header("Debug")]
public bool debugDraw;
public bool showGizmos;
public bool showOverlay;
public Color overlayColor = new Color(0, 0, 0, 0.5f);
@ -213,6 +214,9 @@ void CmdClientToServerBaseline_PositionRotation(byte baselineTick, Vector3 posit
lastDeserializedBaselinePosition = position;
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 (baselineIsDelta)
OnClientToServerDeltaSync(baselineTick, position, rotation);//, scale);
@ -224,6 +228,9 @@ void CmdClientToServerBaseline_Position(byte baselineTick, Vector3 position)
lastDeserializedBaselineTick = baselineTick;
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 (baselineIsDelta)
OnClientToServerDeltaSync(baselineTick, position, Quaternion.identity);//, scale);
@ -244,6 +251,9 @@ void CmdClientToServerBaseline_Rotation(byte baselineTick, Quaternion rotation)
[Command(channel = Channels.Unreliable)] // unreliable delta
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}");
OnClientToServerDeltaSync(baselineTick, position, Quaternion.identity);//, scale);
}
@ -258,6 +268,9 @@ void CmdClientToServerDelta_Rotation(byte baselineTick, Quaternion rotation)
[Command(channel = Channels.Unreliable)] // unreliable delta
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}");
OnClientToServerDeltaSync(baselineTick, position, rotation);//, scale);
}
@ -324,6 +337,9 @@ void RpcServerToClientBaseline_PositionRotation(byte baselineTick, Vector3 posit
lastDeserializedBaselinePosition = position;
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 (baselineIsDelta)
OnServerToClientDeltaSync(baselineTick, position, rotation);//, Vector3.zero);//, scale);
@ -340,6 +356,9 @@ void RpcServerToClientBaseline_Position(byte baselineTick, Vector3 position)
lastDeserializedBaselineTick = baselineTick;
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 (baselineIsDelta)
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.
if (IsClientWithAuthority) return;
// debug draw: delta
if (debugDraw) Debug.DrawLine(position, position + Vector3.up, Color.white, 10f);
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.
if (IsClientWithAuthority) return;
// debug draw: delta
if (debugDraw) Debug.DrawLine(position, position + Vector3.up, Color.white, 10f);
OnServerToClientDeltaSync(baselineTick, position, Quaternion.identity);//, scale);
}