AI Perception: How to do gradual detection?

I have set up AI Perception and the enemy will see me/chase me/etc.

But how can I make it so the detection will be gradual? If I’m too far in his cone, it will trigger a different behaviour and only if I’m close he will fully detect me

And maybe also, how can I have other things (light, camo or texture) affect this “detection %” value

I’ve tried looking for tutorials but I don’t even know how to search for it

Hy there!

For check if the character is in shadow you have to make an actor with lightsource and sphere collision with it. The sphere collision overlapping should start Tick a LineTraceByChannel with the start of your lightsource and the end of your character. This will give you a value that you can use in your character to check if he is in light or in shadow. You can make a system with it depending on multiple variables (like is the character crouching or is in camouflage) wich will set your ‘Visibility’. If you got this ‘Visibility’ then in the AI Controller you can make some branch wich will start different actions if you are in the different ammount of visibility. Of course you have to set theese actions in Behaviour Tree. And call them from the AI Controller depending on visiblity. For the Sun you have to act similar but without the sphere collision since the player is always in its ‘range’.

I hope it helps you to get a littlebit closer to understand how to control your AI.
For the light here is a good tutorial: - YouTube

Wish you good luck!