AI using Navmesh + a Vector

I have a sheep AI currently working in my game that uses a navmesh to find random places to path towards. I intend on having a function that will output a random vector to the AI to help it determine where it should go and at what speed. Will these two things work together with the navmesh automatically?

For example, lets say a sheep was at position 0,0,0 and it received a random vector of 5,5,10, will the sheep begin flying in the air since z = 10? Or will it just path along the navmesh to the best of its ability using that vector?

If not how can I go about this? Should I just create an endpoint with the vector to tell the sheep to move towards at a certain speed? How can I ensure that the endpoint will be on the navmesh and not in the air or below the ground on a hilly terrain?

Thanks for the help!

Pathfinding request destination is being projected to navmesh before kicking off the pathfinding algorithm, so as long as your destination is within default navigation query extent (configurable via Project Settings -> Navigation System -> Supported Agents ) from navmesh you’re fine. C++ pathfinding API allows you event to specify a custom extent yourself.

Cheers,

–mieszko

Thanks Mieszko!