Detecting the player when stood in a shadow

Is there a way to detect whether or not an actor/pawn/anything is stood within a shadow? Ideally this will be to signal an event when the player is stood inside shadows. I could use triggers but that would be a lot of effort if there’s an easier way.

I know you don’t want to use triggers, but having the lightsources as blueprints and adding collision components as large as the radius they light up around could work. You could consider the player is in shadows as long as he does not overlap with those collision components. This even could work for moving lights.

That could work, came up with the solution of having a line trace coming from the location of the light sources and constantly ticking towards the player’s location so if it hits something that isn’t the player it returns false. So far its worked out quite well but I can foresee some possible problems later on.

This might be heavy performance wise later on since you are calling the trace every frame. And could be even more problematic when you have the lights moving,swinging etc. Also you have to make a multitrace and get hit results etc.

Surely performance could be handled but I dont know, having a collision seems still a better idea :stuck_out_tongue:

i use raycast on visibility to check if the sun is shining at the player, then i check his head’s rotation in relation to the sun and check whether he is looking in the direction of the sun with a 180 degree error margin, then I make his face go tense as if the sun is agitating his eyes through a timeline which just reverses upon one of these conditions being false.

I suppose if you know where the light source is, you could use this method, its cheap, apart from the 9000 vertex morph on his face.

I did this recently for project I’m working on, level blueprint below

preview video Added Shadow detection original seen in souls project - YouTube

1 Like

Thanks so much for this!!!

I wonder if this works with cloud cover too, I am still trying to implement that.