- Home /
Worldspace EulerAngle.x regardless of z rotation ?
I need to know the global rotation, in Euler angles, specifically the x component of my GameObject. The problem is that the animation that rotates my game object on the x axis flips the z axis at 90 degree intervals. The animation makes the game object appear to do a 360 degree rotation but as the z axis changes the EulerAngles.x value appears to pingpong e.g. 350,340,320,290,260,290,320......
How can i calculate the EulerAngles.x component of my gameobject in respect to worldspace disregarding of the rotation applied to the z axis ?
Tentative suggestion. Take the Transform.up vector and use Atan2() to get an angle. I think you want to use x and z as the parameters for Atan2().
Answer by Loius · Feb 06, 2013 at 02:45 PM
So you're spinning an object along its Z axis, and trying to get how far back it's tilted?
Use .localRotation ('local orientation') instead of .rotation ('world orientation').
Answer by amcneilly84 · Feb 10, 2013 at 05:22 PM
The issues is the model is a ball that is spinning on the z axis and rotating on the x axis. i need a way to find the worldspace rotation of x
Answer by amcneilly84 · Feb 10, 2013 at 05:19 PM
The issues is the model is a ball that is spinning on the z axis and rotating on the x axis. i need a way to find the worldspace rotation of x