Hi, I just need the direction vector of a light, and I searched the API document, and did not find anything useful, is there any code snippet to do this?
not exactly sure what you mean- it’s just an object so you can get it from the matrix just like any other object. A “light” doesn’t have a concept of a direction per se, since a point light is omnidirectional and a spotlight has a focus direction but the light does not travel in a straight line.
If you just want the rotation angle of the light, it’s just
Sorry, I did not make a clear description of my question. I just want a light of a sun (with a sun, all light directions from it are all the same), and I need to know it’s light direction vector in my script, but I am not able to figure out how to get it, should be nice if anyone can help.
It seems your solution:
object.rotation_euler gives me the right answer for a sun. Thank you.