[Python] Blender API Question - rotation about center of object

Discussão em 'Python' iniciado por Stack, Março 6, 2025.

  1. Stack

    Stack Membro Participativo

    I am running the following code. I would like to rotate the selected blocks about the x-axis in the center. However, it is rotating about the corner. Can I ask for assistance?

    import bpy
    from mathutils import Matrix, Vector
    import math

    angle = math.radians(45)


    for obj in bpy.data.objects:

    if(obj.location.x > 1.1):
    obj.select_set(True)
    print(obj.location.x)
    bpy.context.view_layer.objects.active = obj



    bpy.ops.transform.rotate(value=math.radians(90) , orient_axis='X')
    print("hello33")


    [​IMG]

    Continue reading...

Compartilhe esta Página