PDA

View Full Version : node to get the absolute word value of a poly ?


berniebernie
03-12-2009, 07:02 PM
the title says it all


I am using the distance between node for rigging, but as soon as I include my objects into groups the translate values are understandibly broken.

Is there a node to get the real world position of an object ?

I do not want to use expressions (so I guess xform is out of the question?)
I would rather not have to check if the object has parents (because as I understand plugging the worldmatrix might do the work -- but does it mean that I need to do the extra connections for each extra parent ?)

thanks for your help !

bernie

Keilun
03-12-2009, 09:29 PM
worldMatrix will do it for you:

The worldMatrix instanced attribute is the 4x4 transformation matrix that transforms the object to world-space. There is a world-space matrix for each unique path to the object. Eg. 'ball.worldMatrix[0]' identifies the world-space transformation matrix for the first instance of the object 'ball'. Each world-space transformation matrix is the result of post multiplying the 'matrix' attribute by corresponding 'parentMatrix' instanced attribute (i.e. worldMatrix[i] == matrix x parentMatrix[i]). Thus, the worldMatrix is the concatenation of the 'matrix' attribute of all the dagNodes along the path from the node up to the root of the dag hierarchy.

The worldMatrix is the concatenated matrix from the top-most parent down to the DAG node that you're querying the worldMatrix from. So no, you don't have to go up and query parents.

There will be [X] entries in the .worldMatrix attribute, one for each unique path (instance) to the shape. You should be able to just extract the translation values from that world matrix to obtain its center point in world space.

berniebernie
03-13-2009, 11:12 AM
thank you !


I shall give it a go and come back here and shout !

CGTalk Moderation
03-13-2009, 11:12 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.