Is there a command AI Move As Close As Possible To Position?

TL;DR: Is there a command AI Move As Close As Possible To Position? Which given a vector will move the AI to a reachable point on the NavMesh which minimises the distance between the actor and this input vector

I’m writing a stealth game (in the vain of Thief 1/2). I’m currently working on the AI and trying to implement noise arrows.

The basic concept is the player fires an arrow and on hit the arrow generates a noise and AI will investigate this noise by walking towards it.

Simple idea, straightforward, until you account for the fact that the arrow can hit anywhere in the level including points which aren’t on the nav mesh and thus the AI Move To command will fail as the path is unreachable.

The solution I’ve tried is based on the actual hit location of the arrow (denoted as HL), from HL I perform a line trace downwards until an object hit and store this position as Downwards Trace (DT), and then I use a Project Point To Navigation to get the closest position on the Nav Mesh to the hit location and stored as CP.

The basic idea was to get the AI to move to the closest point (HL, DT, or CP) whether the AI can reach it. However, if neither of these points are reachable the AI gives up.

Sorry for the longwinded explanation, I just thought I should show my progress.

Using the command AI Get Random Reachable Point In Radius is similar to what I want, but I don’t want a random point, I want the closest point in this radius

Hello
I don’t know if it work but
-If you give a range to the noise make by the arrow
-and than tou tell to the ia to search in a random point in the radius near the arrow could this work ?
(sorry for the bad english :confused: )

But the problem is I don’t want a random point in the radius of the noise, I want a point on the Nav Mesh closest to the AI.

Also there would be a problem with the random point if the arrow is fired at a build (where there is a NavMesh on the roof) see image

This is what I want to happen

I’ve also tried Project Point To Navigation with a large Query Extent but that doesn’t work, it can be workable. But the problem is, is that if the roof is closer to the noise than the floor, it will project the point to the roof. I could remove the NavMesh from the roofs but I’d rather not do that, because I want some enemies to be on the roof

Just throwing this out there… Could you zero out the Z value of the point where the noise is being made somehow? Or not zero it out, but have it set to the Z value of the AI bot you’re talking to. Then move to this new XYZ location where XY are from the arrow and Z is from the AI?

Good thinking, but in this situation it wouldn’t work :frowning:

True. Hm. Will go back to the proverbial drawing board.

I asked this question on Reddit and got a response refering me to EQS https://docs.unrealengine.com/latest/INT/Engine/AI/EnvironmentQuerySystem/ so gonna give that a look

Yeah, I saw your post there and the responses. EQS could definitely be something to look into. Keep us posted :slight_smile:

Here’s which I have currently, which has somehow managed to magically do roughly what I’ve wanted (until I test tomorrow and it won’t work anymore :wink: )

a bit late. Made a tutor about:
“Move character to the nearest accessable point on navmesh if the endpoint is unreachable.”
it is in russian, but looks it doesnt need translation.