RaycastModifier keeps the path flying over the ground while crossing slopes


we are having a problem using the RaycastModifier.
We use a LayeredGridGraph in the game and we are encountering cases where the paths when crossing a slope don’t stick to the ground. There are cases where it happens, and others where it doesn’t, but we can’t find a clear pattern.

Captura de pantalla 2023-10-25 131650

Captura de pantalla 2023-10-25 134423

As you can see in this screenshots and gifs, the paths are correctly calculated following the ground nodes (beige colour) while the post-processed paths (green color) flies over the ground.

This is not always the case, as there are cases where the path is post-processed correctly.

We have tested both by checking “use Graph Raycasting” or “use Physics Raycasting”, and by changing the Quality values.
We even have cases where in the same 3D, the downward path is miscalculated and the upward path is calculated correctly.

Captura de pantalla 2023-10-25 132156(Physic Raycast - Highest)

We are using version v4.2.18.
What could be the cause?
If necessary I could send by private the test project where I have generated the screenshots.

Thank you very much.


This is the expected result. The path is simplified as long as linecasts between adjacent vertices does not hit an obstacle. The Y-coordinate of the navmesh is not intended to be used to position characters very accurately.
The included movement scripts like AIPath will instead use physics to position itself on the ground.