(b651e55f4) Don't quantize physicsbody velocities server-side. Caused subs to occasionally not move horizontally because the velocities got rounded down to zero if the sub wasn't accelerating fast enough.

This commit is contained in:
Joonas Rikkonen
2019-04-08 12:06:53 +03:00
parent 153b08065b
commit 2fe8139ffd
2 changed files with 8 additions and 4 deletions
@@ -383,7 +383,9 @@ namespace Barotrauma
tempBuffer.Write(SimPosition.X);
tempBuffer.Write(SimPosition.Y);
float MaxVel = NetConfig.MaxPhysicsBodyVelocity;
AnimController.Collider.LinearVelocity = NetConfig.Quantize(AnimController.Collider.LinearVelocity, -MaxVel, MaxVel, 12);
AnimController.Collider.LinearVelocity = new Vector2(
MathHelper.Clamp(AnimController.Collider.LinearVelocity.X, -MaxVel, MaxVel),
MathHelper.Clamp(AnimController.Collider.LinearVelocity.Y, -MaxVel, MaxVel));
tempBuffer.WriteRangedSingle(AnimController.Collider.LinearVelocity.X, -MaxVel, MaxVel, 12);
tempBuffer.WriteRangedSingle(AnimController.Collider.LinearVelocity.Y, -MaxVel, MaxVel, 12);