Is there a way of detecting a light source hitting a mesh?


I am making a stealthy type game and when my character is in the dark, is there a way the engine can detect that my character is not greatly lit by say point lights/spot lights? I have dim lighting in some rooms and in the corners it is dark… when i’m in the corners i want it to detect that im not lit… is there anyway to get the variable or information of this? Or a work around?

I know I can do this by using collision boxes in certain areas that are dark to switch me a boolean saying stealthed for example. But to me this way is clunky and collision boxes are rectangular which isnt helpful for this.

Thanks in advance guys

I don’t think it’s possible to get lighting information from scene. I’d like to have that too :slight_smile:

For your case you can make an actor with collision volume (box, sphere, even a custom mesh such as a pyramid or a cone) and on begin overlap event you can start measuring distance from player to center of your “shadow” actor - the closer the player to the center the more hidden he is - that way you can even have levels of how deep in the shadows the player is.

Or just a boolean like you said. But the point it you can use various shapes for detecting collision, not just a box.

I think a better way to do it would be in reverse- Have a “light actor” that you place where your actual lights are. Same deal : the closer the player is, the more lit he is. Further from the center → more in the shadows. that way when you’re building a level, you place your “light actors” on top of the real lights and Bob’s your uncle:)