VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Quaternion AVR.Phys.AVR_GrabNode.get_target_rotation ( Quaternion  hand_rot)
inline

Definition at line 47 of file AVR_GrabNode.cs.

47  {
48  // Hand rotation * local node rotation (relative to the master grabbable). This is the rotation the grabbed object should have
49  // if allowed pitch, yaw and roll were to be 0
50  Quaternion zeroAngRot = hand_rot * (Quaternion.Inverse(transform.rotation) * master.transform.rotation);
51 
52  // Rotation of the master grabbable. This is the rotation the object should have if allowd yaw pitch and roll were to be >360.
53  Quaternion fullAngRot = master.transform.rotation;
54 
55  // Rotation from zeroAng to fullAng
56  Quaternion fromToRot = fullAngRot * Quaternion.Inverse(zeroAngRot);
57 
58  // Clamping rotation by yaw pitch roll values
59  fromToRot = AVR.Core.Utils.Geom.ClampQuaternionRotation(fromToRot, new Vector3(allowed_pitch, allowed_yaw, allowed_roll));
60 
61  return zeroAngRot * fromToRot;
62  }
AVR.Phys.AVR_Grabbable master
Definition: AVR_GrabNode.cs:41