- Home /
Question by
ChaiKnight · Nov 06, 2016 at 02:34 PM ·
rotationrotate objectparentinglocalrotation
Keep Rotation on one Axis but aligning others to Parent
I have a problem keeping one axis locked. i have two tools I can use to grab this mock-up needle like object.
I just need to be able to keep its rotation around itself (local y) and align the rest with the tool's rotation. Currently, however, I can only figure out how to rotate all the axes like so:
The code just looks like this:
case 1:
this.transform.rotation = leftParent.transform.rotation;
this.transform.SetParent (leftParent);
break;
case 2:
this.transform.rotation = rightParent.transform.rotation;
this.transform.SetParent (rightParent);
break;
What i have tried:
Using .Set on both local and global rotation, keeping the y and/or the w rotation
= new Quaternion as local and global rotation, keeping the y and/or the w
Rotating the needle after matching the parent rotation
Rotating the needle after parenting it
Please let me know if there's something obvious I have missed. Thanks!
f4beeffd2418a6748b0af7a9f3255c38.png
(49.4 kB)
9071d1859a28070d81f6f39dffc77410.png
(23.0 kB)
Comment