Hi guys,
I’ve been working on my first game and have most of the levels/characters/logic in place but the pathfinding is really giving me a tough time.
The idea behind the game is the ‘enemy’ characters chase the player around the level. The problem is that existing pathfinding scripts tend to focus on the positions of forward/backward and right/left but I also want to introduce up and down (as the character is flying).
Being a noob I’m really struggling to get this in place, most of my game is setup I just have this last hurdle to overcome.
What way would you recommend I tackle this?
I think a node-based algorithm would work here. You place nodes around the level at different heights, and connect the nodes where you can move from one to the other.
I posted a node based pathfinding library here a few days (or was it weeks?) ago, you can probably find it. It’s not perfect but should work.
Can you give any more detail about what kind of obstacles there are and how the NPCs manoeuvre around them? Typically, a pathfinding algorithm doesn’t make any distinction between 2D and 3D (quite often, nodes are modelled as Vector3 with one of the axes set to zero, but the algorithm still works without this restriction). Smag’s suggestion is most likely what you need, but it might cause problems if you have tight, narrow passages like a 3D maze, say.