I am an absolute beginner, please forgive me if this is a basic question. I am using Blender 2.91.

So I have n objects one in the middle and others surrounding it and the one in the middle is the parent of everything else. I am rotating the middle one using keyframes that results in the others revolving around it. Now I am playing it using python and have a handler for frame change. Here I want to extract object properties like location and position of each object for each frame.

Currently I am using obj.rotation_euler and obj.location to fetch the properties, but I get same values for all frames. (I am doing this inside the handler, so I presume it has the current frame properties in the ‘scene’ param?)

So can you please tell me how to extract these properties per frame. Note, I need to do some mathematical calculation with the values , if that makes any difference.

Will be grateful for any help.

Edit 1 :

def process_obj_location(scene):    
if scene.frame_current in frame_read_counter:
print(f"\nProcessing object location for frame : {str(scene.frame_current)}") 
# for obj in bpy.context.scene.objects:
for obj in scene.objects:
  if obj.type == 'MESH': 
      location = obj.location
      object_instance = scene_objects_dict.get(obj.name, None)

print(f"Finished processing locations for frame {str(scene.frame_current)}")

  • $\begingroup$ Showing your code will help us writing an answer. Basically you have to multiply (@ operator) local coordinates by matrix_world property of the object. $\endgroup$ Commented Feb 7, 2021 at 23:32
  • $\begingroup$ Hi. Actually I was not sure which part of the code to post, however I have added what I think is relevant. Thanks for your reply. Can you please tell me how to use the matrix_world. It says 'NameError: name 'matrix_world' is not defined' to me. I did 'location = obj.location@matrix_world' $\endgroup$ Commented Feb 8, 2021 at 0:02
  • $\begingroup$ Finally understood what you meant :').. loc = [email protected] worked! Thank you! How can I select your answer as the correct one? $\endgroup$ Commented Feb 8, 2021 at 0:17

1 Answer 1


I haven't tested your code, but if everything else works, you will be fine after replacing

location = obj.location


location = obj.location @ obj.matrix_world
  • 1
    $\begingroup$ Or simply location = ob.matrix_world.translation $\endgroup$
    – batFINGER
    Commented Feb 8, 2021 at 11:46

You must log in to answer this question.

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