I'm trying to rotate parts of an armature with code and finding that pieces of the armature have their axis oriented differently for some reason which makes looping through the pieces and doing the same thing impossible. Rotating on the Z axis in a positive direction for one is a negative direction for another. Through fooling around with the armature options, I found that I can see the Z axis for one is pointing up while another it's pointing down. How can I fix it so that both are the same while not destroying the weights to my mesh? Can't I just say "voila, your axes are now this way!"?

enter image description here

  • $\begingroup$ Yes you can use local axis and orthographic view for example to do stuff the same way no matter if the armature is on its head. I recommend you do it manually and write down carefully what you are doing by hand and then reproduce it with code. That's at least what works for me. $\endgroup$ – WhatAMesh Aug 12 '18 at 19:35
  • $\begingroup$ I can "do" it, sure, but I want to loop through 6 pieces and tell all of them to rotate on Z in a positive direction and then see them all rotate in the same direction. I don't want the loop to say if i==3 then rotate in a negative direction and if i==5 then rotate on Y instead, etc. $\endgroup$ – CodeMonkey Aug 12 '18 at 19:39
  • $\begingroup$ What by doing it manually first I mean find steps that work for all armatures in the same way and make use of orthographic view, normals and locals axis for that (to normalize the orientation) $\endgroup$ – WhatAMesh Aug 12 '18 at 19:43
  • $\begingroup$ I guess I'm too much of a newb to know what any of that means. I'm doing the programming in Unity. I'm just telling each bone individually to rotate on Z. I want to modify the model so that when I tell it to rotate on Z it does the same thing as the rest of them. But if I rotate the bone now to get the Z in the same alignment, the mesh gets whacked. $\endgroup$ – CodeMonkey Aug 12 '18 at 19:47
  • $\begingroup$ Do you have a .blend that you can share together with your script and/or a short description of how to reproduce it? $\endgroup$ – WhatAMesh Aug 12 '18 at 19:51

You should just be able to correct bone roll in edit mode, which won't deform the mesh. This may still cause issues if you have some constraints specified in world space, but should otherwise be fine. In python this would be changing the EditBone, not the PoseBone.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.