The detection system. Visibility from the hill.

Designing a vision system for characters.

This works well until the character is at the top.

I can finish the rays so that I get something like a cone with a convex base. But I don’t think this solution is elegant and I don’t know how to iterate over all the endpoints (LineTraceByChannel) in the loop.

I would be grateful for your advice and help. Thanks.

Hi, any reason why you don’t use the build in AI Perception system? That has no problems detecting objects from or at a hill/height difference. And the AI Perception system will be faster, more flexibly and powerful and already implemented =)

Otherwise I would suggest that you change your approach. Instead of doing traces from the AI and hoping that they hit the right thing, register all actors that the AI should be able to see (save them into an array). Then loop through that array and do a linetrace from the AI to each of the actors it is able to perceive. If the linetrace is does hit that actor, then the AI can see the actor. That way it won’t matter whether there is a height difference or not. If you want to limit the view distance or the view cone, you can do a distance test and a dot product (between AI view vector and vector to actor) test and first filter by those.