I have 3 plank forming an equilateral triangle, I want to rotate them according to the triangle gravity center (where all the height intersect).

By hand I select them all, Shift+D, Enter, R, Shift+Z, turn the mouse, press Enter and voila, perfectly rotated.

I then wrote a script that does the exact same thing, however they are not rotated the same, the center of the second triangle is off.

def select_all():
    scn = bpy.context.scene
    print("deselecting all")
    objs = [obj for obj in scn.objects if obj.name.startswith("plank")]
    for obj in objs:
        print("selecting object " + obj.name)
        obj.select = True

bpy.ops.transform.rotate(value=radians(180.0), axis=(0, 0, 1))

and here is an image of the results :

enter image description here

Why isn't the rotation being the same?



Your Answer

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

Browse other questions tagged or ask your own question.