I’m working on a game with a “fear” mechanic where if the player is in an area with little to no light, their fear value will slowly increase but I haven’t been able to figure out a way to get the amount of light surrounding the player. I’ve found some advice where they said to do a line trace with the player and the light source and check they are visible or to put a collision sphere with the same size as the light radius and check if the player is in the sphere, but this wouldn’t quite work for my situation. I also wanted a second player to be able to suddenly turn off a light source in order to try to increase the player’s fear level in order to win the game. I’m still fairly new to Unreal and I would appreciate any help with this aspect.
There is no built in method for calculating it. You need to do line trace to all light sources around and calculate amount of light.