How to move to targets not on navmesh

By default, MoveTo tasks and other navigation movement will use the nav agent’s default query extent (configurable in project settings). This is not very large usually, so you may need to manually project using a larger extent.

The following approach allows you to somewhat intelligently choose the best location to move to:

  • Take target position and generate points around it
  • Project each point to navmesh
  • Choose the point closest to the moving actor

The reason we take multiple points around the target is that this way we get multiple choices. If we only projected the target’s position, it can end up on whatever side of the navmesh is closest to it. This in turn can cause the moving actor to move to the opposite side of the target, which can be undesirable.

Links

Interesting approach for turning radius: https://forums.unrealengine.com/t/turning-radius-for-ai/148241/19