- Home /
How to check if an object is lit by a light?
How can one check to see if light from a lamp is illuminating an object?
.
This is obviously already being calculated by the render engine, so it would make sense that you could just use that information to return a true/false
.
Main goal: I need to check at the end of each turn if a player's game piece is being illuminated by a lamp source or if it is occluded by an object (a person entirely behind a wall would not be illuminated, but a person with an arm sticking out from behind the wall would be marked as illuminated (it needs to be very accurate)).
.
The source would be singular, so a raycast of sorts might work, but aside from casting at an object's origin, I wouldn't know how to go about checking for any extensions of an object that might be exposed.
.
Ideas?
Answer by jamessykwan · Dec 28, 2017 at 04:46 AM
Vector3.Distance(light to obj) is a quick method
I think you misunderstood my question. The main light in the scene would have a (nearly) infinite distance so every object in the scene could be illu$$anonymous$$ated by it at any time. What I want to check is if the light is illu$$anonymous$$ating any part of an object's mesh, or whether that object is entirely hidden behind another object.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
BoxCast does not work at Runtime, but in Game Mode (sometime strange results...) 0 Answers
Bouncing ball never becomes stationary 1 Answer
How do I create a polygon that reflects light like the built in 3D objects? (e.g like the cube) 1 Answer
Multiple Cars not working 1 Answer