Make a light always face origo (0,0,0)

I’m using a DirectionalLight as a sun in a small game i’m working on. The sun will circulate around the world and change it’s light to simlulate sun up and downs. This will be synchronized with a skysphere or similar.

Well… to my actual question. I want the DirectionalLight to always face/be directed to origo. Point (0.0f, 0.0f, 0.0f) in the world. How can i do this using the lights setDirection()? How do i calculate the correct direction?

You’l need to know the position of the sun.

Usually to compute a direction between 2 points, you must subtract the destination to the target, then normalize the result.

since your destination is 0,0,0, and that the sun position is a vector from the origin to the sun position, you just have to negate the sun position.

what you have to do is :