applying rotation to imported object causes it's location to change randomly


rotation = (0,0,math.radians(angle * (vertex_count + 1)))
bpy.context.object.rotation_euler = rotation

I do that, nothing crazy happens, object is at the correct coordinates, just needs to be rotated 90 degrees on another axis…

If I do:


rotation = (math.radians(90),0,math.radians(angle * (vertex_count + 1)))
bpy.context.object.rotation_euler = rotation

It goes bananas, placing the object all over the place at random coordinates, with no apparent consistency.

It’s worth noting that I am importing a .obj file and after setting it’s location and rotation, I am parenting to another object created using the cylinder_add function.

I think it has to do with parenting, something similar happened to me in the GUI, not sure exactly what workflow I did to cause it though, most of the time parenting didn’t cause the child to go crazy. I tried applying transforms.

I re-exported the .obj files after centering the objects, applying location and rotation. Seems to be working.