Infinitely thin unwalkable area?

I ran into an issue with pathfinding. This may be very simple but I couldn’t figure it out. In my MMORPG game, I noticed creatures running around an impassible fence were getting way too close to it (even right ON it), as though it were infinitely thin. Then fence, however, has a thickness of 0.1 or 0.2 world units. Its thickness is not ignored by Unity’s Navmesh maker but it seems to be with A* Pathfinding. Please note that the creatures did not penetrate the fence, the node list returned still does have them run around it, but they just get too close or even on top of it as they circumvent it.

Please take a look at this screenshot:

As you can see there is a triangle whose line goes right through the fence. Is that little strip to the right of the fence supposed to be unwalkable area or is that another walkable polygon that does not have a connection to the other side? If it’s not passable, then it looks like its shifted a bit rather than being centered on the fence.
I did try increasing my character radius a bit but this didn’t help. I don’t want to increase it too much. Any ideas anyone ?

Hi

It looks like the system does not have enough resolution to accurately divide the navmesh.
However I also know that it tends to offset the navmesh very slightly on the +x +z direction sometimes. I have not yet looked in to it that much yet (I did look in to it a bit, but it is a very large process and it is not easy to debug).
I have never seen it actually be offset so much that it actually misses an object however, I have only seen it make a slightly larger navmesh margin on one side of an obstacle compared to the other side.

It could also be that the navmesh is too aggressively simplified, try to reduce the ‘max edge error’ setting.

Also. What is the cell size of your graph?

The cell size is 0.5. It’s 3000x3000 voxels and the world is 1500x1500 units. Tile size is 128.
I believe everything is pretty much what the defaults were for a 1500x1500 world.

Ok I have just verified. There is definitely an 0.5 voxel offset that is being applied somewhere. Will work on figuring it out.

Usually it doesn’t matter much because the resolution is much higher.

Ok. I think it was just a rounding issue. Here is a patch with a fix: http://pastebin.com/86Sfw26j
The last change is the most important one, the rest don’t affect much.

1 Like

Just to let you know, I finally applied this patch and it works perfectly! :slight_smile: So the barrier was just offset due to rounding, it wasn’t thinner. Thanks Aron!

1 Like