Getting the position of an object with a constraint?

Hi All,

I have a camera that is parented to an empty.
The empty has two constraints to other points in the scene.
I have cross animated the influence on the constraints to cause the empty (and the camera) to move between the points.

I want to write a bake routine that fetches the position of the empty. But because the empty is being “re-positioned” by the constraints, it’s location is always 0,0,0.

I am sure it is a matrix thing, but how do I get the true position of an object with a constraint?


obj.matrix_world.to_translation() seems to work, also had to activate offset in my second Copy Location constraint to get it right…

Thank you for the reply.

I came up with a similar variation but it is good to know about the to_translation portion of the world matrix.

loc = ob_reframe.location * ob_reframe.matrix_world

Basically multiply itself by it’s own matrix.