How do I rotate an object around the local axis using python?
Maybe something like this answer.
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.Sign up to join this community
I found this question
and from it I got this:
import bpy import numpy from mathutils import Euler def set_loc_rotation(obj, value): rot = Euler(value, 'ZYX') obj.rotation_euler = (obj.rotation_euler.to_matrix() @ rot.to_matrix()).to_euler(obj.rotation_mode) obj=bpy.data.objects['Cube']; set_loc_rotation(obj, numpy.radians([30,0,0])) #rotates by 30 deg on local x axis set_loc_rotation(obj, numpy.radians([0,0,30])) #rotates by 30 deg on local z axis