I want to create a few animations of a flying ball with initial velocity and get its collision point with a wall. Therefore I created a sphere and 2 keyframes (using animated option in rigid body). At the second keyframe I turned off the animated option to let the physic engine take over. Everything works fine until now. For my purposes, however, I need to track the coordinates of the sphere to get the collision point with the wall. During the animated part, I can use
For the second part I found out that
ob = bpy.data.objects['Sphere'] bpy.context.scene.frame_current = some_number bpy.context.scene.update() print(ob.matrix_world.to_translation())
works. However, as soon as I want to loop over all frames:
for i in range(1,max_frames): bpy.context.scene.frame_current = i bpy.context.scene.update() print(ob.matrix_world.to_translation())
it is not working anymore, e.g. it always prints the starting position. It seems that update() does not update the position correctly, I found the "set_frame" method in some older posts but it seems not to exist anymore in v2.77. Any suggestions how I could solve this problem?