Agent's Y pos in recast graph

I am using the recast graph to generate terrain, but I’m hoping to optimize the agent’s Y pos issue. I see that the AIPath source code uses Raycast to specify the collider to confirm the Y pos. However, I don’t want to use a collider, I would prefer to adjust the agent’s height automatically, similar to Unity’s built-in NavMesh. For example, is it possible for me to obtain the Y pos of the recast graph at the current position to set as the character’s height?

Hi

Generally, I discourage positioning the agent based on the navmesh position. It’s usually much more accurate to use raycasts.

In the beta, you can get the position using:

var nn = NNConstraint.Walkable;
nn.distanceMetric = DistanceMetric.ClosestAsSeenFromAboveSoft();
var positionOnNavmesh = AstarPath.active.GetNearest(transform.position, nn).position;