Hi,
I’m working on game that uses grid graph. With enemy AI, I use ABPath to try to figure out if target character can be reached and what is the shortest path to it.
However, when trying to find the path to enemy I get into following situation.
The vertical lines mean following:
- Green: The target I give to my AI path (where the target character is located)
- Blue: End node of the path returned
- Red: End position of the path returned
- White short ones: path points (path points going other direction are paths to other evaluated characters)
The path returns complete for me offering path (red arrow), when I actually think I should get the path like green arrow there in this case as I should not be able to move from node with blue vertical line to node with green vertical line due to height difference.
The path is requested with following
var path = ABPath.Construct(source, target);
path.nnConstraint = GetPathConstraint();
AstarPath.StartPath(path, pushToFront);
and constraints I use are
pathConstraints = new SampoNNConstraint()
{
constrainWalkability = true,
walkable = true,
EntityId = _characterEntity.EntityId,
constrainArea = true,
area = (int)characterEntity.GetNavigationData().NavigationAreaId
};
Any thoughts what I’m not figuring out here and how I could get desired result and the path to be calculated matching more the green arrow?
I’m currently using version 4.3.70 of A* Pathfinding Project.