- Home /
Rotate z and y together?
Hi,
when i rotate a character in y and z ( together ), the character ends up facing the ground. When i try to rotate each axis separately, it works fine, but together it does not work. Would you know how to fix this?
Here is my code :
transform.Rotate( (-Vector3.forward * 10 * Input.GetAxis("Horizontal")) + (Vector3.up * speedRight * Input.GetAxis("Horizontal")) );
Thanks a lot
Comment
Best Answer
Answer by Pauls · Jan 22, 2013 at 06:14 AM
So i had to separate the two rotations: one for the character, and create its parent and assign the second rotation to this parent.
Yeah as far as I remember this is mostly how the FPS controller standard asset did it.