This commit is contained in:
Sveske_Juice 2024-03-05 00:28:27 +01:00
parent 5da9a7c15d
commit 5fbba01ca0
1 changed files with 5 additions and 5 deletions

View File

@ -66,7 +66,7 @@ public class RopeSimulator : NetworkBehaviour
[Header("Netcode")] [Header("Netcode")]
private const int k_rngSeed = 6969; private const int k_rngSeed = 6969;
private const float k_sendRopeDataRPCThreshold = 0.1f; private const float k_sendRopeDataRPCThreshold = 0.1f;
private const float k_ropeReconciliateThreshold = 0.25f; public float k_ropeReconciliateThreshold = 8f;
private System.Random rng = new System.Random(k_rngSeed); private System.Random rng = new System.Random(k_rngSeed);
private int[] order; private int[] order;
@ -286,9 +286,9 @@ public class RopeSimulator : NetworkBehaviour
Debug.Log(diff); Debug.Log(diff);
if (diff > k_ropeReconciliateThreshold) if (diff > k_ropeReconciliateThreshold)
{ {
Debug.LogWarning("Reconciliating rope!"); // Debug.LogWarning("Reconciliating rope!");
this.rope = serverRope; // this.rope = serverRope;
Debug.Log(Rope.CalcDiff(this.rope, serverRope)); // Debug.Log(Rope.CalcDiff(this.rope, serverRope));
} }
} }
@ -303,7 +303,7 @@ public class RopeSimulator : NetworkBehaviour
rope.points.Last().position = end.position; rope.points.Last().position = end.position;
float ropeDiff = Simulate(Time.fixedDeltaTime); float ropeDiff = Simulate(Time.fixedDeltaTime);
if (IsServer && ropeDiff > k_sendRopeDataRPCThreshold) if (IsServer)
{ {
Debug.Log($"Sending rope to client"); Debug.Log($"Sending rope to client");
NetworkRope nrope = Rope.ToNetworkRope(this.rope); NetworkRope nrope = Rope.ToNetworkRope(this.rope);