Improved character movement lag compensation

This commit is contained in:
Regalis
2015-11-03 18:15:12 +02:00
parent 2a8939f6dc
commit 963f46e7d1
8 changed files with 46 additions and 26 deletions
+12 -7
View File
@@ -42,7 +42,7 @@ namespace Barotrauma
//a movement vector that overrides targetmovement if trying to steer
//a character to the position sent by server in multiplayer mode
private Vector2 correctionMovement;
protected Vector2 correctionMovement;
protected float floorY;
protected float surfaceY;
@@ -692,15 +692,15 @@ namespace Barotrauma
{
if (inWater)
{
foreach (Limb limb in Limbs)
{
//if (limb.body.TargetPosition == Vector2.Zero) continue;
//foreach (Limb limb in Limbs)
//{
// //if (limb.body.TargetPosition == Vector2.Zero) continue;
//limb.body.SetTransform(limb.SimPosition + newMovement * 0.1f, limb.Rotation);
}
// limb.body.SetTransform(limb.SimPosition + Vector2.Normalize(diff) * 0.1f, limb.Rotation);
//}
correctionMovement =
Vector2.Lerp(targetMovement, Vector2.Normalize(diff) * MathHelper.Clamp(dist * 5.0f, 0.1f, 5.0f), 0.2f);
Vector2.Lerp(targetMovement, Vector2.Normalize(diff) * MathHelper.Clamp(dist * 8.0f, 0.1f, 8.0f), 0.2f);
}
else
{
@@ -732,6 +732,11 @@ namespace Barotrauma
}
}
public virtual Vector2 EstimateCurrPosition(Vector2 prevPosition, float timePassed)
{
return prevPosition;
}
private Vector2 GetFlowForce()
{