- Home /
See whether player is in range of light
Is it possible to detect whether the player is in any light's range? It can't be per light, I need to take into account all the lights on a certain layer.
Comment
Best Answer
Answer by Rabbit-Stew-dio · Mar 21, 2012 at 10:55 PM
Why dont you combine your lights with a trigger-sphere? This way, you can listen to "OnTriggerEnter" and count up and down when you enter or leave one of these spheres.
Answer by m4c0 · Mar 21, 2012 at 10:51 PM
You could add each light a script that uses a ray cast or a Vector3.Distance to calculate the distance.