1
$\begingroup$

I try to design a physics animation with python / bpy.

The simulation as such is fine.

But I try to read the coordinates of falling objects while running the simulation. For this purpose I use bpy.app.handlers, which are called each time the frames change.

But if I try to access the locations of the falling objects, it seems, that the you not change (although the objects are obviously falling).

So I could guess, I would have to bake the simulation for the locations are updated??

But more important: if not location is the property associated with the falling cubes in the animation viewport, which field could I use to access the simulated positions WITHOUT baking the physics simulation before??

$\endgroup$

1 Answer 1

2
$\begingroup$

Use matrix_world, e.g.

>>> C.object.matrix_world.translation
Vector((0.0, 0.0, -5.041865825653076))
>>> C.scene.frame_set(C.scene.frame_current + 1)
>>> C.object.matrix_world.translation
Vector((0.0, 0.0, -5.451406955718994))
$\endgroup$
1
  • $\begingroup$ Nice! Thank you. Works fine! $\endgroup$
    – Mike75
    Commented Sep 17, 2022 at 14:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .