# Mesh does not stay flat against same degree mesh when rotating on x-axis

I have a lego arm, and the body, but the arm does not rotate correctly.

I re-set the object's origin to be the center of the shoulder:

But when the object is rotated on the X-axis only, it appears to rotate on the Z ans Y axis as well a little.

How do I keep the mesh to stay flat against with the other when rotating?

Blend file:

New Blend file:

• Do a google search for local and global axis... important concepts if you want to do 3D – cegaton Jan 17 '18 at 20:31

The arm is rotating as expected, the apparent problem lie in the fact that the plane of arm joint is not perpendicular to X axis, it is slightly inclined toward it.

The behavior you are expecting can be achieved by rotating around an axis that is perpendicular to the arm joint, it happened that the local space of arm is aligned with the plane of the arm joint, so rotating around the local Z axis of the arm will achieved what you want. Simply change to Local Transform Orientation and rotate by using R >> Z + Z.

Let us, however, assume that the local space of the arm is not aligned with the joint. We can then create a local space manually and rotate around it. A possible way to do it is by adding an empty that is perpendicular to the joint's plane, this can be done by aligning the view to the faces of the plane of the joint and adding an empty using the Align to view option. Parent the object to the empty and rotate around it's local Z axis as explained above.

• For some reason, I press Z twice after R, and it stays with the global rotation. – Akados Jan 17 '18 at 19:50
• @Akados Are you sure you set the transform orientation to local first? – Omar Emara Jan 17 '18 at 19:53
• Yes at the bottom, it says it rotates along the local Z axis. But appears to rotate around the Global. – Akados Jan 17 '18 at 20:02
• @Akados Can you reupload the file? – Omar Emara Jan 17 '18 at 20:12
• New one added. It used to be parented to the body if that changed anything. – Akados Jan 17 '18 at 20:18

Change the Order of the Euler Rotation.

If you wish to animate the rotation of the arm by keyframing in only one axis: Possibly the simplest way is to change the order of the Euler Rotation. If the order is changed to 'ZYX' the arm can be swivelled around local z axis without it being affected by its y axis rotation.

@OmarAhmad 's answer shows well the "seemingly erratic" nature of the x, y, z rotation values with differing orders, in this case 'XYZ' as in original file.

Changing the 3D view transform orientation to local also aids to visualize it's the local z axis you wish to rotate on.

To set local X as the rotation axis.

Part 2 in response to "Is there a way to reset or rotate the arm so it can rotate correctly only with the x-axis?"

shiftS Snap 3D cursor to origin. Tab into edit mode and select all. Make sure pivot point is set to 3D cursor and your are in front ortho view NUMPAD 1

R-90 will rotate such that x axis is pivot axis.

Tab back to object mode.

R90 will rotate the arm back to shoulder. You can now rotate on local x axis using 'XYZ' Euler.

Other methods could be to use an armature, or empties at the joints.

• Is there a way to reset or rotate the arm so it can rotate correctly only with the x-axis? – Akados Jan 17 '18 at 19:47
• @Akados yes, edited answer. – batFINGER Jan 17 '18 at 20:13
• Thanks. Now I figured out my issue is that I applied rotation in a further update of my model. I use your edited method and I was able to rotate on the Z Local axis again. But when it is rotated both on the Z local and global, they both make the mesh look like it's rotating on the X Global. Is there a way to undo the applied rotation, if that will fi the problem? – Akados Jan 17 '18 at 23:40
• Could use same method as outlined in part 2 above, rotate the whole mesh in edit mode about the origin such that you have x axis normal to plane and y z on plane. (or download the first version of the file) – batFINGER Jan 18 '18 at 4:22