Equivalent of NavMeshAgent.isOnNavMesh or get if FollowerEntity is grounded

  • A* version: 5.4.5 (Pro)
  • Unity version: 6000.3.0.f1

I’m in the process of migrating Unity’s pathfinding solution to A* Pathfinding Project. I’m using a Recast graph and FollowerEntities. I need to know if an agent (FollowerEntity) is grounded and snapped to the Recast graph, but I can’t seem to find any pulbic FollowerEntity properties that would satisfy this requirement.

Solution example: agent.isOnNavMesh -> followerEntity.isOnGraph

Thanks!

I did some digging on my own but I want to confirm some stuff with Aron. He or I will get back to you on this soon :+1:

Hi

This you can check with ai.hasPath. It is always snapped to the navmesh as long as it has a path.

There’s no exposed property for this at the moment, but you could probably do something like this:

var entityManager = ai.world.entityManager;
var closestOnNavmesh = entityManager.GetComponentData<MovementState>(ai.entity).closestOnNavmesh;
if (Mathf.Abs(closestOnNavmesh.y - ai.position.y) > 0.05) {
	// Not grounded
}
1 Like