If the distance is excessively large when forcing the collider of a dead character to follow the body, the collider is teleported instead of moving it by setting the velocity. + More physics error logging

This commit is contained in:
Joonas Rikkonen
2018-08-09 14:13:08 +03:00
parent f697ec7582
commit f99bec4ed2
3 changed files with 45 additions and 11 deletions
@@ -64,8 +64,16 @@ namespace Barotrauma
}
else
{
Collider.LinearVelocity = (MainLimb.SimPosition - Collider.SimPosition) * 60.0f;
Collider.SmoothRotate(MainLimb.Rotation);
Vector2 diff = (MainLimb.SimPosition - Collider.SimPosition);
if (diff.LengthSquared() > 10.0f * 10.0f)
{
Collider.SetTransform(MainLimb.SimPosition, MainLimb.Rotation);
}
else
{
Collider.LinearVelocity = diff * 60.0f;
Collider.SmoothRotate(MainLimb.Rotation);
}
}
if (character.IsDead && deathAnimTimer < deathAnimDuration)