- Home /
Question by
patrick508 · Jun 27, 2020 at 12:56 PM ·
rotationtransform3d
How to rotate child object regardless of orientation?
Hi,
So I have 4 objects, which all have childs underneath. I want to rotate these childs slowly when a button is pressed.
Example: Spacebar is pressed, and for all 4 parent objects I want to rotate the child down slowly. Problem is, they need to use the same script, but all of their orientations are different.
So if I do the following:
pbone.transform.rotate(Vector3.down speed Time.deltatime);
Childs of parent 1 move down perfectly, but childs of parent 2 move to the left and right, because they have a different orientation. When I rotate them by hand in Unity, for parent 1's childs I need to move the Y axis to get them to rotate down, but for parent 2's childs it's the Z axis.
How can i always move it down regardless of any orientation?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613001924im_/https://answers.unity.com/themes/thub/images/avi.jpg)