Check how close objects rotation is to another object

Hello Unity community

I’ve spend the past couple of days, making a game for my school.
The purpose of the game is to rotate a solar panel, to draw energy from the sun.

I tried lots of things, but there is one thing i have a problem with.

When you as a player rotate the solar panel, I wan’t it to check, if it’s x rotation is within 60 of the Sun x rotation etc.
So I can award the player with more energy the closer solar panel rotation is to the suns.

So far I tried lots of weird things, like making 3 objects, that have the same rotation speed as the sun, and then raycast. but nothing helps, so hope there is an easier solution.

Thank you.

See here: Unity - Scripting API: Vector3.Angle

You want to pass in the sun’s direction vector and the direction your solar panel is facing, perhaps making one of them negative.