I have a problem keeping one axis locked. i have two tools I can use to grab this mock-up needle like object.
![alt text][1]
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:
![alt text][2]
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!
[1]: /storage/temp/81666-f4beeffd2418a6748b0af7a9f3255c38.png
[2]: /storage/temp/81667-9071d1859a28070d81f6f39dffc77410.png
↧