A* Pathfinding Project

Point graph on a planet has missing connections



I’m using a point graph to do pathfinding on a planet that isn’t perfectly spherical (for reference, it uses a mesh collider). The points for the graph are generated uniformly using the Fibonacci sphere algorithm and then mapped onto the planet surface.
What I’ve run into is an issue related to how nodes are connected. Here’s what I mean:

This is the planet surface. And as you can see it’s quite smooth in that area.

This is what the graph looks like in that area.

It doesn’t look like that everywhere on the planet, and if I replace the mesh collider with a sphere collider, the connections are alright. Also, the issue happens every time I try to generate the graph.

Does anyone have any idea what might be awry?

Thanks in advance!



Are you using raycasts for blocking connections (this is an option in the point graph). If so you might want to disable that, or change the layer mask.


We do use raycasts to block, yes, but there is no obstacle in between the missing connections in the screenshots I linked, so they shouldn’t be blocked by anything.



The mesh collider might be blocking them. If the raycasts are being done right at the surface, then they may or may not succeed depending on floating point errors.


How about raising the points used to generate graph? A tiny bit above surface (less than 1 unit) may help.


Seems like that’s the way to go. We went for that a while back and it worked fine, and then removed the code that added the offset because it looked just fine without it. Clearly, not the case.
Thanks for the idea!