diff --git a/Assets/Scripts/Networking/Instances/Client.cs b/Assets/Scripts/Networking/Instances/Client.cs
index a781806..1465710 100644
--- a/Assets/Scripts/Networking/Instances/Client.cs
+++ b/Assets/Scripts/Networking/Instances/Client.cs
@@ -119,6 +119,7 @@ namespace NeonTea.Quakeball.Networking.Instances {
} else {
Ping = Instances.Server.PingInterval + 0.001f;
}
+ UpdatePingBias();
}
}
}
@@ -144,6 +145,15 @@ namespace NeonTea.Quakeball.Networking.Instances {
}
}
+ private void UpdatePingBias() {
+ foreach (NetPlayer p in Players.Values) {
+ if (p.Id != LocalPlayer.Id) {
+ p.Controlled.PingBias = Ping;
+ }
+ }
+
+ }
+
public override void UpdateLocalPlayer() {
if (SelfIdentified && Server != null) {
PlayerUpdatePckt pckt = LocalPlayer.Controlled.CreateUpdatePacket();
diff --git a/Assets/Scripts/Networking/Instances/Server.cs b/Assets/Scripts/Networking/Instances/Server.cs
index 2a8ae5f..e1a54df 100644
--- a/Assets/Scripts/Networking/Instances/Server.cs
+++ b/Assets/Scripts/Networking/Instances/Server.cs
@@ -113,10 +113,14 @@ namespace NeonTea.Quakeball.Networking.Instances {
if (!ping.ServerReceived) {
ping.ServerReceived = true;
Peer.SendReliable(conn.uid, ping);
+ NetPlayer p = Players[conn.uid];
if (ping.Identifier == LastPingIdent) {
- Players[conn.uid].Ping = Time.time - LastSentPing;
+ p.Ping = Time.time - LastSentPing;
} else {
- Players[conn.uid].Ping = PingInterval + 0.001f;
+ p.Ping = PingInterval + 0.001f;
+ }
+ if (p.Controlled != null) {
+ p.Controlled.PingBias = p.Ping;
}
}
}
diff --git a/Assets/Scripts/Players/Player.cs b/Assets/Scripts/Players/Player.cs
index 54f6f65..5a62f07 100644
--- a/Assets/Scripts/Players/Player.cs
+++ b/Assets/Scripts/Players/Player.cs
@@ -10,7 +10,7 @@ namespace NeonTea.Quakeball.Players {
/// The duration after running off a cliff, during which the player should still be considered grounded.
public float CoyoteTime;
- public float CoyoteTimePingBias;
+ public float PingBias;
/// How often should the player's movement be updated? Used by Local and Remote -Player classes.
public float UpdateFrequency = 1f;
@@ -121,7 +121,7 @@ namespace NeonTea.Quakeball.Players {
}
public bool Jump() {
- bool IsCoyoteTime = Time.time - GroundedTime <= CoyoteTime + CoyoteTimePingBias;
+ bool IsCoyoteTime = Time.time - GroundedTime <= CoyoteTime + PingBias;
if (IsCoyoteTime || IsGrounded()) {
GravitationalVelocity = Vector3.up * MoveStyle.JumpVelocity;
Vector3 Pos = transform.position;