A* Pathfinding Project

Another spherical world issue


Hello! Recently bought the full version as I saw some topic and some videos that it should work on spherical planets. The example beta that features the spherical test is missing the main mesh.

I’ve sorta got it working using a mesh nav mesh, and now I’m wondering what all the colors are? I’ve got the recalculate normals enabled, and without it, it looks like this
Will experiment more with having agents there.



Spherical pathfinding is very experimental at the moment and not officially supported.
For spherical pathfinding you should have recalculate normals disabled, otherwise it will try to recalculate the normals of the triangles with the assumption that the up direction is along the positive Y axis, which is incorrect for a spherical world.
Your second screenshot looks good.


Thank you so much for your reply.
Couple questions, can I scale the navmesh uniformly, or would I have to regenerate it, if the planet started scaling?
And for making unwalkable areas, the mesh gotta have holes in it, yeah?


Yes, you asked about that in your other post.
It’s an O(n) operation though, so it’s not intended to be used every frame or anything like that.

Yes, the mesh should have holes in it.


Thank you so much, this works like I wanted it to. Thanks for a great asset once again.


Also, if you feel like supporting the package even more, a rating and or review in the Asset Store helps a lot :slight_smile:


You bet, wonderfull support as well.


Hello again @aron_granberg

        var graph = path.data.navmesh;
        graph.scale = 300;
        graph.rotation = new Vector3(-90, 0, 0);
        graph.offset = Vector3.zero;
        var transform = graph.CalculateTransform();

This sets the scale on the nav mesh indeed, however it doesn’t update it before I actually call or press Scan. Is this intentional or am I missing a call somewhere?



You have to Scan it once first to generate the nodes, but then calling RelocateNodes should update the existing nodes’ positions.


Not the behaviour I’m seeing. I can see in the inspector that the scale is set to 300, but I have to press scan manually to get it the right scale.
I’ll update to the latest, non spherical beta version, and report back.


Hello again, I’m sorry for the forum spam.
I’m basically having some issues with multiple navmesh areas overlapping. https://streamable.com/gg4bl
Using the TargetMover script, it sometimes selects the nav mesh underneath another navmesh, and I’m worried I can’t really fix that as there isn’t a “on top” since I’m using spherical worlds.
Any suggestions?



For your mesh to work as a navmesh it needs to be a connected surface. A navmesh is defined as all surfaces where the character can walk, and the character is allowed to walk through connected triangles in the mesh. It looks like you have multiple disconnected surfaces there.