Server doesn't send character position updates to far-away clients, clients disable characters if they haven't received position updates in a while

This commit is contained in:
Regalis
2017-02-07 18:59:25 +02:00
parent b98ebe6e21
commit d46207916f
6 changed files with 48 additions and 88 deletions
+5 -5
View File
@@ -33,16 +33,16 @@ namespace Barotrauma
public override void Update(Camera cam, float deltaTime)
{
if (!Enabled) return;
base.Update(cam, deltaTime);
if (!Enabled) return;
float dist = Vector2.Distance(cam.WorldViewCenter, WorldPosition);
if (dist > 8000.0f)
float dist = Vector2.DistanceSquared(cam.WorldViewCenter, WorldPosition);
if (dist > 8000.0f * 8000.0f)
{
AnimController.SimplePhysicsEnabled = true;
}
else if (dist < 7000.0f)
else if (dist < 7000.0f * 7000.0f)
{
AnimController.SimplePhysicsEnabled = false;
}