I am trying to check if a game object has been rotated past a threshold on a single axis and then do something if that threshold has been passed. However, I want to check the rotation relative to the main camera’s frame, not the parent or world frames.
How can I get the game object’s rotation relative to the main camera frame?
I tried using FromToRotation like this:
Quaternion diff = Quaternion.FromToRotation(Camera.main.transform.rotation, this.transform.rotation);
But FromToRotation takes in two Vector3 references and I only have quaternions.
I feel like I’m missing something simple, but I’m looking at the Quaternion API (Unity - Scripting API: Quaternion) and I don’t think any of these methods do what I want.
Any advice welcome!