Hey Aaron and fellow A*-er’s.
I’m working on a 2.5D platformer prototype and want to use a 2D X/Y pathfinding solution, similar to the writeup here:
http://www.rocket5studios.com/tutorials/make-a-2d-game-with-unity3d-using-only-free-tools-beginning-enemy-ai-with-a-pathfinding/
However, this doesn’t cover something integral to the concept, and that is how to navigate with Door Portals.
I’ll let the picture help explain…
http://i.imgur.com/h3Cy8hS.png
This guy heard my gunshot through the wall and now he wants to hurt me. Those black boxes are the door portals and I want the AI guy across the wall from me to know that the shortest path to get to me is factoring in these “shortcuts”. In this particular case, the initial room that the AI is in does not connect to any other room on a grid graph, so he needs to rely on the door portal.
Does A* have something like this in consideration already that I’ve missed? If not what would be the complexity/first steps to implement?
Here is a video showing some gameplay. The pathfinding is just my custom stuff and I’m trying to figure out if I can move to A* with it, but the Door Portals are a hard stop.
Thanks!
Hello Aron and community.
I’m also interested in this feature. It would be nice to know if there is something like this already in A* Pathfinding Project Pro.
For example, Apex pathfinding system has such implementation: http://www.youtube.com/watch?v=Ks3wPmeFqcY.
Thank you in advance.
Hi
Yes, there is support for this. However right now it is not that well documented and it works best for recast graphs (or rather, it works best with the RichAI movement script, which only works on recast/navmesh graphs).
You would use the NodeLink2 script (name pending) to connect the nodes. This is all well, however there is currently no support (except for in the RichAI script) to detect that link and actually perform a special action when traversing it.
It can relatively easily be hacked together however. In your movement script, you want to detect when the current node you are moving to is a PointNode, the NodeLink2 script inserts point nodes at the start and end of the link so if the movement script moves towards a point node, then you know it is traversing a link. So if you detect that, you can just teleport the character.
You can also do something hacky like detect if the distance to the next node is very large (larger than the normal distances between grid nodes), then just teleport.
2 Likes