3
$\begingroup$

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 !!

$\endgroup$
4
  • 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
    Commented Sep 13, 2015 at 9:02
  • $\begingroup$ I added python & scripting because I want to access the values using the notation --> ob.location[1] $\endgroup$ Commented Sep 13, 2015 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
    Commented Sep 13, 2015 at 12:18
  • $\begingroup$ related: blender.stackexchange.com/questions/28031/… (basically the same question and same answer, but more python-oriented) $\endgroup$
    – rfabbri
    Commented Sep 13, 2015 at 18:54

1 Answer 1

5
$\begingroup$

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).

$\endgroup$
0

You must log in to answer this question.

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