I'm facing the same issue now. Could you please share your code so I can understand how to solve this problem? In my animation, the objects visibly move, but their location values remain the same as the starting frame.
Here's the code I've been using:
import bpy
def collect_first_and_last_locations(time_start, time_end):
'''Collect first and last global locations of all MESH objects based on time (seconds).'''
scene = bpy.context.scene
frame_rate = scene.render.fps
frame_start = int(time_start * frame_rate)
frame_end = int(time_end * frame_rate)
scene.frame_set(frame_start)
first_locations = {obj.name: obj.matrix_world.translation.copy() for obj in scene.objects if obj.type == 'MESH'}
scene.frame_set(frame_end)
last_locations = {obj.name: obj.matrix_world.translation.copy() for obj in scene.objects if obj.type == 'MESH'}
return first_locations, last_locations
#=========================================================================================# #=========================================================================================# #=========================================================================================#
time_start = 0.0
time_end = 200.0
first_locations, last_locations = collect_first_and_last_locations(time_start, time_end)
print("First Locations:")
for name, location in first_locations.items():
print(f"{name}: {location}")
print("\nLast Locations:")
for name, location in last_locations.items():
print(f"{name}: {location}")