- Home /
How do I fix rotational axis of an object?
I need to be able to rotate an object cleanly in the x, y, and z directions without rotation in one axis throwing off the rotation in another axis. Here's an image to illustrate my problem.
The figure on the left is the initial state of the object before rotation. The figure on the right is the state of the object after rotation in the y axis. This rotation has thrown off the z axis.
How do I make the rotate the object independent of its current rotation?
Nim
Isn't there a pivot to center toggle box at the top by the transformation tools?
Answer by rutter · Oct 16, 2013 at 09:17 PM
How are you rotating the object? Sounds like you're rotating in local space, but would like to be rotating in world space.
If it's in a script, you can call transform.Rotate() and specify that you're rotating it in global space (pass Space.World
for the relativeTo
param).
If it's in the editor, around the top left of your screen there should be a pair of toggle buttons: pivot/center and global/local. Set the second button to "global", and your rotations will be performed in world space.
Answer by mjl1966 · Jan 13, 2015 at 05:33 AM
I'm having the exact same problem. transform.roatate (x,y,z,Space.World) works great and keeps all axes aligned to world space. The problem is that there is no equivalent for explicitly setting the rotation while keeping the axes fixed. I've tried every flavor of transform.rotation and quaternion rotations. All of them use local axes. (You can say "local" or not all you want. It doesn't matter. It's ALWAYS local.)
I think this is a good candidate for an RFE: be able to explicitly set a rotation of an object using the global axes in the exact same way that .rotate uses Space.World. (How Harvester did his Navball without this is mystifying.)
Your answer
Follow this Question
Related Questions
rotation to axis conversion problem? 1 Answer
Freeze specific rotation axis of a child 2 Answers
Spinning a sphere, like a globe. 1 Answer
90 Degree stopping rotation on y-axis issue 0 Answers
LookAt on one axis 2 Answers