Get navigable point in radius with line of sight to target for AI
I'm trying to get a position for an AI to move to within a certain radius in which he has line of sight to a certain target (i.e. it is possible to cast a trace from the ai pawn to the target pawn without hitting something). I have thought about using an EQS that generates points in a grid but I don't think it is possible to pass in some kind of target where the filters should be based on (line of sight from point to target, distance from point to target). I also thought about using the navigation system from c++ but I don't quite know how to work with that navigation system.
I hope the image below clarifies it a bit, blue is the target here and red has to move to the right(R) position while W would be closer but does not give him line of sight.
Any answer in either blueprint or c++ would be greatly appreciated! Bonus points if it could be extendable to other conditions!
I think EQS would fit your needs. Here you have two contexts. The blue and the red one. What you can do is to use pathing grid. To the pathing grid add a distance test from the blue context to filter points that are closer to the blue context than a given radius. Then you can add another distance test from the red context to score those points that are closer to the red context. Now you have the points in a given radius from red that are closer to blue. To check if the points are in the the Line of Sight of the blue context you should add a Trace test. This test will do a trace from the blue context to every location returned by the previous tests and return only those that are in line of sight. With all these three tests you will obtain the positions that are closer to Red, closer to Blue and also are visible from Blue.
Even in the worst case you can create a custom test in c++ (I have done it and it is not complicated, but it is another thread).
Was this what you wanted?
Hope this helps,
answered Apr 25 '16 at 12:50 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here