Showing results for 
Search instead for 
Did you mean: 

Rotating child of held object using hand tracking

Level 2

Background: I  am attempting to create a rubiks cube that is interacteable with the quest's hand tracking


The issue i am having right now is that the OneGrabRotateTransformer that constrains an to only a rotation in one axis does not seem to work when the object is a child to an other object that is being moved.


The setup i have right now is: A cube with a grabbable and handinteractor. Another cube is connected to this cube as a child, with a grabbable, handinteractor, and a OneGrabRotateTransformer that is plugged in to the grabbables "one grab transformer" input.


Grabbing the child cube and rotating it works exacly as expected if the parent cube is not being held. But if i try to rotate the child cube while holding the parent cube with my other hand, the rotation axis goes absolutely bananas, and will rotate in all sorts of random directions.

Has anyone implemented this type of interaction before, or have any input on what might be going wrong? There is frustratingly little documentation about this (meaning, absolutely zero mentions about OneGrabRotateTransformer anywhere at all), so I am a bit stumped on how to continue with this for now



Level 3

Probably way too late but if the parent transform of the rotating object isn't oriented [0, 0, 0] (identity), the OneGrabRotateTransformer's math is wrong. I haven't pinpointed exactly where yet, but if you replace line 119:

targetTransform.RotateAround(pivot.position, rotationAxis, angleDelta);


targetTransform.Rotate(worldAxis, angleDelta);

it works. 


Note that worldAxis here, is actually referring to the local axis of the child's (object being rotated) transform.


EDIT: Ugh, the constraints are now borked.


So the culprit was simply that the rotate transformers are designed for world space! The "Rotation Axis" actually refers to world space axis. So you're limited to only three axis of rotation, world X Y and Z.


A simple fix for them to work in local rotation axes, lines 86 - 88 (Interaction SDK v39):

Vector3 localAxis =;
localAxis[(int)_rotationAxis] = 1f;
Vector3 rotationAxis = pivot.TransformDirection(localAxis);


Now there is still an unintended bug with constraints, if you continuously rotate past the limit (like a wheel) it "winds up" and you'd have to imaginatively "unwind" before it behaves normally again.


I sort of fixed the wind up, here's a gist of the changes for OneHandRotateTransfomer:

Level 2

Thanks for sharing your discovery @wsinw  , this also helped me to fix handling with stuff that has rotative parts and are placed in hands

Incredible, you saved me from a massive headache!