1
$\begingroup$

I want to rotate a selected item around a specific vertex like this:

 vertex.select=true
 bpy.ops.transform.rotate(value=1)

This code basically rotates at the bounding box center. I have tried setting the pivot point cursor and manually setting the cursor but this does not work.

bpy.context.scene.tool_settings.transform_pivot_point = 'CURSOR'
bpy.context.scene.cursor.location = (1,1,1)
    
bpy.ops.transform.rotate(value=1)

The result is still a rotation with axis at the objects center point.

I'm looking for a simple, scripting level solution to this problem.

$\endgroup$

1 Answer 1

2
$\begingroup$

The bpy.ops.transform.rotate() rotates on the object's origin.

You can do bpy.ops.transform.rotate(value=yourValue,center_override=(x,y,z)) where x, y and z are the x, y and z of the vertex.

Basically the center_override overrides the rotation pivot position.

$\endgroup$
1
  • $\begingroup$ Amazing! I can't believe I missed that! $\endgroup$ Aug 31, 2020 at 12:52

You must log in to answer this question.

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