Usman
Usman

Reputation: 901

location of objects not changing in any frame for physics simulation

I am new to blender and using it for generating a dataset for another problem that I am working on. I use physics simulation to make objects fall. The problem I am facing is that the object.location value does not change after simulating. I can see that the objects did move in 3d view. Do I have to do something different to get the location in the last frame? (need python solution for this) I am using the following code for simulating

def simulate(start_frame=1, end_frame=200):
   for i in range(start_frame, end_frame + 1):
       bpy.context.scene.frame_set(i)
       bpy.context.scene.update()

Upvotes: 1

Views: 580

Answers (1)

Usman
Usman

Reputation: 901

I found the answer to my question. In case someone else needs it, global translation can be accessed as follows

bpy.data.objects['obj'].matrix_world.translation

Upvotes: 2

Related Questions