- Home /
Object on illuminated by ligth component
Hello everyone, I'm getting a problem whit scripting. I dont have any idea how to detect when an object has been illuminated by a specific ligth component.
I search in google but can't find a working awnser.
I hope than i can find the rigth awnser here. Have nice day. PS: Sorry, I dont speak english as well.
Answer by ScroodgeM · Aug 06, 2012 at 10:46 PM
depends on the light type.
spot light
check if angle between light forward direction and light-to-object direction is less then half spot light angle check if distance to object is less then max distance of light * check if raycast to object hits object and not other geometry that can hide objectpoint light
* same as above but skip first item with angledirection light
just raycast check from (object-position - light-direction K) to object-position, where K is big enough to be outside from whole scene, to hit any geometry that can cover objectThanks, it is really helpful but How i check "check if raycast to object hits object and not other geometry that can hide object"?
Your answer
![](https://koobas.hobune.stream/wayback/20220613075250im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Enquiry on what are the maximum number of components for a specific object in Unity 1 Answer
Enquiry on what are the maximum number of components for a specific object in Unity 0 Answers
Enquiry on what are the maximum number of components for a specific object in Unity 0 Answers
Disappearing objects or their components in Hierarchy 0 Answers