Distance scaling

This commit is contained in:
Sebastian Broberg
2016-03-04 18:20:17 +01:00
parent 02825782e5
commit 1bc5cb24c1

View File

@@ -472,8 +472,10 @@ namespace Barotrauma
foreach (var gap in ConnectedGaps.Where(gap => gap.Open > 0))
{
var pos = gap.Position - body.Position;
var distance = MathHelper.Max(Vector2.DistanceSquared(body.Position, gap.Position)/1000,1f);
pos.Normalize();
body.body.ApplyForce((pos * gap.LerpedFlowForce) * deltaTime);
body.body.ApplyForce((pos * (gap.LerpedFlowForce/distance)) * deltaTime);
}
}