Navmesh Clamp Component does not clamp manually Moved agent to sloped Recast Graph

Hi

This is by design. The NavmeshClamp component is only intended to clamp the agent on the XZ axes.

Typically, the navmesh is not accurate enough on the Y axis to use for ground collision. You’re usually better off using Physics.Raycast or something similar.

If you really want to, you can use:

var nn = NearestNodeConstraint.Walkable;
nn.distanceMetric = DistanceMetric.ClosestAsSeenFromAboveSoft();
var nearest = AstarPath.active.GetNearest(transform.position, nn);
if (nearest.node != null) {
    transform.position = nearest.position;
}
1 Like