Pathfinding fixes:

- determining if a character is close enough to a waypoint works now, even if the character is too short for its collider to overlap with the wp (e.g. crawlers)
- enemies can drop down from platforms
- an extra waypoint is placed at the middle of stairs to prevent characters from choosing a waypoint on a platform above the stairs as the starting point of their path
This commit is contained in:
Regalis
2016-11-23 22:20:20 +02:00
parent 9061f0e53a
commit 9d1d64901a
4 changed files with 53 additions and 8 deletions
@@ -146,9 +146,11 @@ namespace Barotrauma
}
var collider = character.AnimController.Collider;
Vector2 colliderBottom = character.AnimController.GetColliderBottom();
if (Math.Abs(collider.SimPosition.X - currentPath.CurrentNode.SimPosition.X) < collider.radius * 2 &&
Math.Abs(collider.SimPosition.Y - currentPath.CurrentNode.SimPosition.Y) < collider.height / 2 + collider.radius)
currentPath.CurrentNode.SimPosition.Y > colliderBottom.Y &&
currentPath.CurrentNode.SimPosition.Y < colliderBottom.Y + 1.5f)
{
currentPath.SkipToNextNode();
}