Get directional light direction

Hi everyone,
I want to developpe a game based on a solar panel (SP), I want to compute the power delivred by the SP using the orientation of the SP and the sun.
My question is : How to get the orientation of the sun and the solar panel.
thank you.

Assuming your SP is modelled with the front being the panels…

You would get the foward vector of your SP.

Then get the vector between the Sun and your SP (

The dot products of these two will give you a number you can use to represent how close they are to looking at each other. (

the output of this node will be 1.0 if they are directly facing each other, 0.0 if they are perpendicular, and -1.0 if they are directly opposite each other.