I'm trying to make objects move with python script. Every object on list should move into center of my area. I'm using for loop. Unfortunately first element doesn't want to keep it's initial position on 0 frame. It looks like it is replacing 0 frame position with 20 frame position and then it works properly but it makes every move 20 frames before rest of them. I don't have idea why it is not working properly. Can you see my code and try to find out what is wrong with it?
new_loc = [0,0,0] frame_num = 0 for obj in creatures_names: ob = bpy.data.objects[obj.name] scene.frame_set(frame_num) ob.keyframe_insert(data_path='location', index = -1) new_radius = radius - 4 while frame_num < settings['frames']: frame_num += 20 for obj in creatures_names: ob = bpy.data.objects[obj.name] loc = obj.location x = float(loc) y = float(loc) z = float(loc) creature_angle = math.atan(y/x) print(creature_angle) new_x = new_radius * math.cos(creature_angle) new_y = new_radius * math.sin(creature_angle) new_loc = z new_loc = new_x new_loc = new_y ob.location = new_loc ob.keyframe_insert(data_path='location', index = -1) frame_num = 20 scene.frame_set(frame_num) new_radius -= 4