NavMesh issue: agent does not follow camera

I have been experimenting with the navigation mesh feature, trying to learn how to use it. I have created a miniature maze with two cubes, one is a crowd agent. I can set the agent to go to the other cube in the maze (called “test” in this example) and it works. However, if I switch the crowd agent’s goto destination from “test.position” to “camera.position”, the agent just sits at its starting position and does not move. It will not follow my camera as I expected. I think I’m probably missing something basic, but I am not sure what.

Here is a playground example:

Pinging @Cedric

Hi @nate

The function navigationPlugin.getClosestPoint tries to find a position on the navmesh the closest possible to the position as arguments within a precision range.

The camera position is too much away from a position on the navmesh that’s why you don’t get a result. In order to get a broader search area, you can call:

setDefaultQueryExtent(extent: Vector3): void;

It’s explained in this doc page : Create Navigation Mesh - Babylon.js Documentation

Fixed PG :