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
$\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$
  • $\begingroup$ Amazing! I can't believe I missed that! $\endgroup$ – bigcodeszzer Aug 31 '20 at 12:52

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.