Keep current rotation, apply the same rotation changes as another object
I'm basically trying to improve the grab function from the XR Interaction toolkit. Here is the goal: when I grab an object, I want it too keep it's current rotation. but then if the rotation of the hand changes, I want the rotation of the object change with it. In other words, I don't want the object to have the same rotation values as hand, but I want it to rotation to change the same as hand when grabbed.
First, I have XR Grab Interactable with disabled rotation tracking on the object. For the first part, when the laser is hovered (onFirstHoverEntered) I get the rotation of the object and when the object is selected, I can give it the same rotation back. But then I can't apply the changes in rotation of the hand correctly to the object. does anything like Delta Rotation exist maybe? I thought this was the closest but it doesn't actually work:
Quaternion rotationArray = Quaternion.Euler(originalRotation.x + grabber.transform.rotation.x - originalHandRotationEuler.x, originalRotation.y + grabber.transform.rotation.y - originalHandRotationEuler.y, originalRotation.z + grabber.transform.rotation.z - originalHandRotationEuler.z);
Any help would be seriously appreciated.
Your answer