How to get nav mesh point closest to blocking actor?

I have a destructible object that blocks all movement, but it has a collider that deals with taking hits to destroy it. The problem is I can’t tell my AI to go to that object because it blocks the nav mesh, which I need it to do until destroyed. So I figure the best thing is to move the AI to the closest point on the nav mesh to that actor, but everything I try does not work.

I’ve tried ProjectPointToNavigation and GetRandomReachablePointInRadius with a rather large radius (large as the screen for testing sake) and both always have a false return. So it seams they always fail if the origin isn’t on the nav mesh. My last resort I think will be trying to use EQS for this, but I was hoping to avoid having to do a heavy query.

I should note this is happening in a StateTree Task, but I assume this shouldn’t matter.

Edit: Basically when I tell the AI to move to an actor and that actor isn’t on the nav mesh it of course causes the move call to fail and triggers the fail event. When this happens I need the closest safe location to move the AI to instead. It seams like EQS is the only reliable way to do this, but just checking if there’s a fast method.

Tried with EQS, but EQS refuses to even attempt to find points on the nav mesh around an actor that isn’t on the nav mesh. There has GOT to be a way to do this. There is no possible way this is reality here. There has GOT to be a way to get the closest edge point on the nav mesh for an actor off the nav mesh. Has anyone found out how to best do this? I’m fine with C++ or BP solutions here.

Ok, spoke too soon on EQS. Needed to use SimpleGrid instead of PathingGrid then filter out points that can’t be navigated to. Next score based off closest to target and closest to Querier. Gives the desired result of closest point on the nav mesh. Below is my tester query.

image

Seams to work with my tester, but the AI themselves seam to fail to go to the closest point. This is just so awkward. There really should just be an efficient navigation function call for getting closest point on the nav mesh.

Ok, finally have a solution. I had to improve my attack target logic to keep track of the impact point (finding a target is just a sphere trace). This gives me the closest location to the actor. It’s important because trying to find closest location to actor center isn’t relative to the location of the attacking actor. Next I just use ProjectPointToNavigation, which gives me the location on the nav mesh closest to that impact point and tada. I now have a backup location to move the actor to when it tries to navigate to an actor that isn’t on the nav mesh.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.