I set up 2 bodies manually & assigned Copy Location constraint to one with respect to another body. Then I set up the keyframe for the guiding body & then I started to view the change in the location of the constrained body. What I noticed in the 3D viewport was the constrained object moves, but when I look into its real position the values are stagnant. Why is that? I was unable to find my answer in previously asked questions by other people !!

  • 1
    $\begingroup$ It's a bit unclear what you mean by "stagnant". Did you try to change the offset and space parameters of the Copy Location constraint? What effect are you trying to create? $\endgroup$
    – TLousky
    Sep 13 '15 at 9:02
  • $\begingroup$ I added python & scripting because I want to access the values using the notation --> ob.location[1] $\endgroup$ Sep 13 '15 at 11:09
  • $\begingroup$ OK, maybe add some detail about that in your question, since the description doesn't mention it? And maybe try to add more info and images or a screen recording to demonstrate the problem. I at least couldn't understand precisely what the issue is from the description... $\endgroup$
    – TLousky
    Sep 13 '15 at 12:18
  • $\begingroup$ related: blender.stackexchange.com/questions/28031/… (basically the same question and same answer, but more python-oriented) $\endgroup$
    – rfabbri
    Sep 13 '15 at 18:54

object.location will never give the "correct" position for a object that has a constraint on it (or a parented object).
That comes from the way parenting and constraints mess with the global coordinates (their effect gets calculated after the object.location).

To get the world position of the a child object (or an object governed by a constraint) you should use object.matrix_world.translation.
matrix_world returns a matrix for the object's transformations in world space. The .translation part will convert the matrix to a location vector (just like .location).

The blender wiki has a good read for further explanation about the coordinates for parented objects (same principals for constraints).


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.