i found the piece of code below to move an object around and works pretty good. but what i would like to do is rotate the cube around its own axis, i have googled for solution but it vain , the function applyRotation didn’t work, rot. also didn’t work, rotation_euler same thing, what i’m looking for is something like ob.rotation instead of the ob.location so if someone know how to solve this , i would be very thankful.
if not ‘Cube’ in bpy.data.objects:
frames_per_revolution = 120.0
step_size = 2*math.pi / frames_per_revolution
x = math.sin(n) * 5
y = math.cos(n) * 5
z = 0.0
ob = bpy.data.objects.get(“Cube”)
ob.location = (x, y, z) # something like ob.rotation
every frame change, this function is called.
frame = scene.frame_current
n = frame % frames_per_revolution
if n == 0: set_object_location(n) else: set_object_location(n*step_size)