Is there any method to get location of an object which has "follow path" and "track to" constraints?

import bpy
scene = bpy.context.scene

The code above gives me constant location of an object, relative to the followed path I suppose

I would like to get global location instead, just like in case of an object with no constraints.

Any suggestions will be appreciated :)






  • $\begingroup$ it may be necessary to call a scene.update() before reading the values of matrix_world -- if you notice that the values don't change even though the UI does display changed values. $\endgroup$ – zeffii Sep 8 '15 at 15:09
  • $\begingroup$ see: blender.stackexchange.com/questions/27667/… $\endgroup$ – zeffii Sep 8 '15 at 15:11
  • $\begingroup$ Thank you atomicbezierslinger, ".matrix_world" do the job for the object location :) And how about the rotation? Could it be also read from this matrix? I've made some test, but I got not obvious results and I couldn't figure out which matrix elements correspond to rotation. $\endgroup$ – Alice Sep 9 '15 at 10:42
  • $\begingroup$ Did you have any success? I am still not clear on that. $\endgroup$ – atomicbezierslinger Sep 9 '15 at 16:21
  • 1
    $\begingroup$ There should be a decompose() function on the matrix that lets you determine the location, scale, and orientation. $\endgroup$ – Mutant Bob Dec 7 '15 at 15:39

Once you've set your constraints, you can see the object's location changing by dragging the time cursor in the timeline. The 'Python' way to do it is to use the function :


Then, you can use object.location to access the 3 Vector containing the location of the object. The indices of the location vector are simply the X, Y and Z components of the location (no link to the frames of the path). The same way, you can access to the rotation of the object using one of these :


Usually, the Euler reresentation of the rotation of the object is preferred. Both the location and rotation of the object are defined globally.

  • $\begingroup$ I think this is where my problem is -while I'm draging the time cursor in the timeline, the values of x,y,z location of the object stay 0, although I can observe that the object is moving along the path in the viewport. This problem doesn't occur in case of the object with movement defined by simple keyframing the object location values. However I really need to have the "follow path" constraint. I use Blender 2.75. Could you please check if there is different result in your Blender instalation? $\endgroup$ – Alice Sep 7 '15 at 13:49

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.