1
$\begingroup$

I nabbed some code that creates created_box object that represents the Arbitrarily oriented minimum bounding box by volume of the selected_object

I get the rotation of the created box like so:

rotX = created_box.rotation_euler[0]
rotY = created_box.rotation_euler[1]
rotZ = created_box.rotation_euler[2]

I want to apply that rotation in reverse to selected_object such that the minimum bounding box is axis-aligned. I think to do this, I need to pass a ZYX euler instead of an XYZ. How would I go about doing this?

$\endgroup$
1
0
$\begingroup$

I set my selected object's rotation_mode to ZYXand entered the values as

    selected_object.rotation_mode = 'ZYX'
    selected_object.rotation_euler[0] = rotX * -1
    selected_object.rotation_euler[1] = rotY * -1
    selected_object.rotation_euler[2] = rotZ * -1    

This rotated the object into the correct position.

Thanks Robert for the link :)

$\endgroup$

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.