- Home /
How do I know if an object is seen? (not when it renders)
Basically, what I need is to know if an object is seen by the player and not by the camera, so I can trigger its AI.
I've already searched and found the several threads talking about this, and how to use render functions to know when the camera renders the object and then use raycast to see if there is something in-between. The problem is, I have a dense fog that only lets me see around 5 units ahead, and the game's brightness is also adjustable.
My first approach was to just set a distance between the player and the object. But due to the game brightness being adjustable, that distance doesn't work for everyone, because some players with high brightness will see it before that distance, and others with a really low brightness will trigger the AI without seeing anything.
My final idea is to make a algorithm that takes in consideration the game's brightness and calculates the optimal distance, but if there's a easier and more plausible way of doing this I would do it.