- Home /
Rotate object based on another rotation above a certain threshhold
The situation is as follows: I want to rotate one object based on the rotation of another object (e.g. a VR controller). Hereby, I'm for example interested in the difference in rotation of that object between two points in time. Only this difference is above a certain threshhold, I want to apply the rotation to the other object.
I am not sure how to classify the "differences" between rotations I was describing in the best way (for example if i should take Quaternions or Euler angles). What would be the best approach to achieve this?
Answer by CodesCove · Jul 07, 2020 at 09:05 PM
You can get and check the difference in two rotations with Quaternion.Angle(rotA, rotB). It returns the difference in degrees (float value) (https://docs.unity3d.com/ScriptReference/Quaternion.Angle.html) So if this difference would be bigger than your threshold value you can just set the new rotation.