I am trying to get the frame-by-frame location of the softbody physics simulation (collision of softbody cube with a plane).
I am incrementing the frame of the simulation using set_frame
However every time I get the location, whether it be from bpy.data.objects["Cube"].matrix_world.translation
or bpy.data.objects["Cube"].location
it gives me the initial location of the cube for every frame. I can see in blender that the cube has moved though.
I also used bpy.context.view_layer.update()
before getting the location of the cube and its still giving me the same results. This is for blender 2.91.
here is the loop I am setting frames and attempting to get location from:
for frame in range(1, 200):
file_name = "frame_" + str(frame) + ".obj"
bpy.context.scene.frame_set(frame)
bpy.context.view_layer.update()
print(bpy.data.objects["Cube"].matrix_world.translation)
Thanks.
Previous posts I have tried the solutions for include:
Location of an object at a specific frame
How can I get the location of an object at each keyframe?
Looping Through Frames of Physics Simulation and Getting Object Info with Blender Python
I suspect this is the reason that the object's location constantly returns as the first frame:
The point I circled in red is the initial location of the object I believe, but the screepcap is the final frame in the scene.