Adjusting recast graph to better conform to terrain?

I’m having an issue where it would be very helpful if the recast graph could follow the surface of curved objects a little better.

See this image:

If the graph followed the slope a little better (especially on the right) I would not have to run ground checks on thousands of units each frame. I know we can export the mesh and edit it, but if there is a way to “tweak” the height resolution, it would save a lot of time.

I tried changing several settings, nothing seems to affect it so far.

Hi

The navmesh is not designed to be super accurate along the Y axis. You can make the tile size smaller to make it more accurate, though.

One thing I have successfully used in another game is to use the normal information from the physics raycasts I do. So once every 5 or 10 frames I do a physics raycast and capture the hit point and the normal. These form a plane, which approximates the ground below the agent. On this plane you can use a much cheaper raycast for the other 4 or 9 frames on which I skip the physics raycast (see Unity - Scripting API: Plane.Raycast). This results in a significant reduction in raycasts needed per frame. You can also use the Unity api for batching raycasts which also improves the performance a lot.

Excellent suggestions! (as always :smile: )

1 Like