Collider-controlled swimming, fixes

This commit is contained in:
Regalis
2016-10-16 20:07:34 +03:00
parent db8c2b9f8e
commit f3e74a6a41
14 changed files with 243 additions and 226 deletions
@@ -88,6 +88,13 @@ namespace Barotrauma
Vector2 diff = DiffToCurrentNode();
var collider = character.AnimController.Collider;
//if not in water and the waypoint is between the top and bottom of the collider, no need to move vertically
if (!character.AnimController.InWater && diff.Y < collider.height / 2 + collider.radius)
{
diff.Y = 0.0f;
}
if (diff == Vector2.Zero) return -host.Steering;
return Vector2.Normalize(diff) * speed;
@@ -95,7 +102,7 @@ namespace Barotrauma
private Vector2 DiffToCurrentNode()
{
if (currentPath == null || currentPath.Finished) return Vector2.Zero;
if (currentPath == null || currentPath.Finished || currentPath.Unreachable) return Vector2.Zero;
if (currentPath.Finished)
{