It's about local coordinates and freeze translation. I know this issue has been discussed before, but I didn't find what I was look looking for:
I do polygonal modelling. After boolean operations the "local" or "object"-axes are set back to world coordinates.
Before the boolean I store the rotations.
After the boolean operation I want to restore the local axis by rotating the new object into zero position, freeze its transforms and rotate it back.
Now my question: I have translateX,Y,Z and rotateX,Y,Z. How can I extract the necessary "reverse"rotations to rotate the object back? Simply negating all the values doesn't work.
You have to make sure you do your unrotating in the opposite order. Since the default is x,y,z - you need to do your un-rotations in the order of z,y,x. Negating the values should work with this.
So if your original is rotated 30, 60, 90... unrotate it zyx 90, 60, 30. Freeze transforms. Rotate forward xyz by 30, 60, 90.
Thank you very much! That was the perfect answere. Here is the final script (in case someone is interested):
global proc string my_axis_from_plane () {
float $ro[]=`xform -q -ro my\_plane`;
if(!`size $ro`) {
print "// ERROR: could not querry my\_planen";
print "// you may define my\_plane with the 'my\_plane\_from\_selection' scriptn";
return 0;
}
FreezeTransformations;
xform -ro (-1 * $ro[0]) (-1* $ro[1]) (-1 * $ro[2]) -roo zyx;
FreezeTransformations;
xform -ro $ro[0] $ro[1] $ro[2] -roo xyz;
return 1;
}
It sets the local axis to a construction-plane called my_plane. I have another script, which defines such a plane at the position of a selected Face, Edge or 3 vertices. It