Hello,
I am trying to create a 2D game with this package and got the general pathfinding down. Now I want to make platforming work, so far the air is walkable and my character flies because of that. Is there anyone that got this to work?
Side scrolling platformer type pathfinding is not something that is well-supported by this package.
You can do some things using a point graph and manually placing the nodes of the graph, but it’s not the most convenient workflow.
This might be a bit hackish, but I generated a second GridGraph exactly like the one that is spanning my entire level. Then I shifted that copy up by NodeSize - in my case 0.25f.
By doing this you can select all nodes that are walkable in the shifted graph but not walkable in the original one, but at the same coordinates in their respective graph.
The original Graph is called “completeGraph”, while the shifted version is called “copy”. This step is (so far) not slow and works just fine. I add the nodes into a List which is in my case called “nodesToKeep”. Then you need to shift the Nodes in “nodesToKeep” by the length of “completeGraph” (-1) to get the actual desired position.
Nodes is simply the GraphNode[ ] of my completeGraph converted into a list
From here on out I will try to check the distance between my walkable Nodes and if they can be reached. Not sure about that part yet. Do you have any input so far that could improve the performance of this @aron_granberg?
For example getting the node like this (still need to make sure the position is not out of bounds - this is only another way to do it):
Edit: This last piece does not work. I will get back to it if I run into performance problems.
I will keep you guys posted, as far as I am concerned this question was asked quite a lot.
@Mezzil , did you ever finish the solution you were working on here? It seems like a very inventive solution. I’m curious to know if you got a working prototype out of it.
I too, am trying to implement some platform pathfinding and the more I read up on it the more it seems like behavior trees are the only real good solution.