Even after hours of googling, I can't really get my head around this. Maybe somebody here can help me a bit with this.
I basically want to determine the Y-rotation of an object (that is always in the viewport's center), relative to my camera. Imagine the object standing on the center of a record player/turntable, that slowly rotates around its Y axis, and my camera always facing the center of that object while using OrbitControls to change the cam's position around the object. Imagine the camera not moving, but the turntable turning, one revolution equals this Y rotation to be between 0°
and 360°
.
For example, this Y rotation would be:
0°
when cam's position is[x=0, y=0, z=100]
, or[x=0, y=100, z=200]
(the cam's y position doesn't matter, it always looks down/up to the group's center),45°
when cam's position is[x=100, y=0, z=100]
or[x=100, y=200, z=100]
,90°
when cam's position is[x=100, y=0, z=0]
or[x=200, y=100, z=0]
, etc.
Thing is, both of these can have some pretty random positions & rotations in the world coordinate system, so it's not given that the object's position is [x=0, y=0, z=0]
.
Any ideas? Thanks a lot!