79354220

Date: 2025-01-14 07:25:16
Score: 9 🚩
Natty:
Report link

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}")
Reasons:
  • Blacklisted phrase (1): how to solve
  • RegEx Blacklisted phrase (2.5): Could you please share your code
  • RegEx Blacklisted phrase (1.5): how to solve this problem?
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): I'm facing the same issue
  • Contains question mark (0.5):
  • No latin characters (1):
  • Filler text (0.5): =========================================================================================
  • Filler text (0): =========================================================================================
  • Filler text (0): =========================================================================================
  • Low reputation (1):
Posted by: ahmadreza khodayari