Mapping changes in transform rotations back to vector2?!

I have a globe object that sits at world origin (0,0,0) but can be rotated and twisted in any direction.

Behind this globe there’s a billboard object that has a scenery texture on it.

What I need to do is be able to manipulate the billboard’s texture offset as the globe is rotated to give the impression of movement. So, as the globe is rotated left or right the texture offset will be adjusted left or right accordingly.

I’m really struggling with an approach on how to do this :sweat_smile:

LateUpdate() captures the delta in the transform.rotation and can convert this into an angle, but of course that doesn’t indicate direction…

I expect I’m missing something blindingly obvious, but would be hugely grateful for any help or pointers!!

I would use a constant like Mathf.Deg2Rad * r to convert the degrees to an arc length. (of a circle with radius r). You wound decide on r maybe based on your globe’s radius or whatever feels right.
You can record the direction based on how you rotated the globe in the first place.
If you don’t know this direction then you can attach an empty transform to you globe but at a slight offset, say r or 1. Then every frame you record the position of this auxilary transform. Then you can compute the angle of rotation based on the position of the transform last frame and position this frame (and convert it to arc length). To determine the direction of rotation you can convert the global position last frame back to local coordinates of the globe (use Transform.InverseTransform)
Say if your transform is locally at (0,0,1) (relative to the globe) and you rotate arount y axis, then the current local position is still (0,0,1), but the global position from last frame is say (-0.1,0,0.9) in local coordinates this frame; you take the sign of the x coordinate to determine if you rotated left or right. If your rotation is more complex, than you would also take the y component to determine if you rotated down or up as well…
Hope this makes sense.

Thanks ivkoni, that really helped! 8)

Following your excellent suggestion I’ve added a hidden child object within the globe at 0,0,-5; a point that is directly facing the fixed camera.

In LateUpdate I can measure the child object’s new world position and then reset its transform.position back to 0,0,-5.

This keeps the maths really simple as its X Y co-ords will always indicate direction and distance traveled since last frame relative to the camera viewpoint, and avoids all of the nasty rotational stuff, inverted poles, backwards winding etc…

Thank you very much :smile: