Download

EQS question : How do I score based on Trace distance to point of hit result?

I want my AI to move to cover at the closest point of a visibility trace. (tracing from the query node to the target pawn, but resulting location where this trace hits)
How do I set this up? So far I can only use a trace to filter a Bool, not a location.

Added image for example. I want to filter out the cover points on the wrong side of the walls (it’s showing them because they are out of line of sight because of the other wall, but it shouldnt be a valid point)

2 year bump, still havent figured this out lol

When you run trace you can break output and get distance float. So you can just compare if current distance < previous distance keep that location. When all traces are finished just return location.

So how do I break the trace inside the EQS?

Hey man, just stumbled upon this while trying to do the opposite of you. Hope you have figured this one out already, but if not. And for anyone that tries to attempt this, you can do it like the following;

  1. Do a Donut: Generate items around Querier
  2. Check distance to Querier and get the minimum value with a scoring factor of -1; this will result in your AI preferring a target closer to it.

  1. Create an Environment Query Context that returns all players (or a specific target if you prefer) and do trace test against it; this is what will actually check if the position provides cover (or has Line of Sight) to target or not

PS. on a side note, you might want to set it to just score as opposed to filter and score otherwise there may be a situation where all the positions fail.

Your final EQS should look something similar to the below; this should result in a behavior where the AI prefers a location closest to it with cover.
This is a very crude and simple method, you can tweak the values as you require.

Annotation-20200128-160330.png