1
$\begingroup$

I have an object obj following a path, and when I run obj.location, it always returns the same value for every frame even though it's moving. How can I get the real position?

$\endgroup$
2
$\begingroup$

Use the matrix world.

An objects world matrix is calculated for every frame, to position all objects globally in the scene regardless of how it is done be it via constraints, parenting, drivers, yada yada.

To get the global location at frame f

context.scene.frame_set(f)
global_location = context.object.matrix_world.to_translation()
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.