String Pulling optimize out height difference between path points

Hello!

I am facing an issue with the String Pulling of the found Path. In case the start and end locations of the Path are located on both side of the hill - the resulting straight path is calculated through the hill, ignoring the NavMesh surface. The attached screenshot illustrates this case.

Is there any engine option to keep the path according to the navmesh curvature? Or how should I modify the code to achieve this?

Appreciate your help.

Kind regards.

It is more the debug view of the path as the points should be on the navmesh surface. The pathfinding walks the polys, but we do not store all points for the final path. Are you seeing pathfollowing go under the ground mesh? Is it for displaying the path in game over the terrain?

-James

The string pulling code is using Recast, so it would be a deep modification to make directly in there. I believe your post process of the path is likely the best place to keep it consistent. You could also add projections at a fixed distance between points for better contouring. This seems very similar to how we do NavWalking mode in CMC.

Hello,

Yes, for a specific AI mode as an optimization, we just interpolate the location over the pathpoints, and in this mode, AI characters might be walking through the hill.

Now, I’m writing the postprocess for the pathfinding, which iterates over pathpoints, checks the midpoint between 2 pathpoints, compares the height with the corresponding location on the navmesh poly, and inserts the new pathpoint at the correct height if necessary. I’m wondering there is any more elegant or proper solution for this, might be directly during string pulling?

- Vladimir