Floating Point Precision leads to different navmeshes for different users

  • A* version: [5.2.5]
  • Unity version: [6000.0.32f1]
    Hi there!
    I was encountering an issue where different users have different navmeshes generated for them. I’m assuming it is due to floating point precision differences.

This is how to reproduce it:

  • Use a layered grid graph
  • Use Grid snapped assets so colliders touch pixel perfect.
  • User A will have a gap between 2 objects in the navmesh
  • User B will NOT have a gap between 2 objects in the navmesh
    Here is the gap:
    Navmesh gap
    The colliders:

It has a gap (only for user A - not for B) when pixel perfect:


No gap when accounting for inprecision

:
Here are our grid settings:

Any idea how to fix this?

  • Ideally i would prefer to not have to move objects outside of the grid (e.g. -5.9999 instead of 6) or prebake the navmesh as this makes the artist workflow harder.

Thank you very much!

We also tried scaling up the problematic objects by 1.01 but size scaling doesn’t seem to be taken into consideration from a*

When you say “users” I’m assuming you mean team members? Is everyone using the same version of Astar and Unity?

Thanks for the quick followup:

yes, other team members.
We did test this on the same changeset (with the same astar + unity version)

Hi

That difference will most likely be caused by the physics engine, not this package itself.
The layered grid graph uses unity physics raycasts to determine where the ground is. If those are inconsistent, there’s not much I can do, I’m afraid.

To avoid having things “pixel perfect” with respect to the graph, you could offset the graph slightly, instead of the world. E.g. have the layered grid graph be offset by 0.01 in the x and z directions.

2 Likes

That worked! Thanks for the help!