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

1 Answer 1

2
$\begingroup$

I set my selected object's rotation_mode to ZYX and 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.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .