 # Transform node matrix attributes

Hi,

What is the exact difference between worldMatrix and Matrix attributes? What about xformMatrix?

If the final matrix is the matrix attribute then what does the worldMatrix do?

Thanks for your patience I think you have that backwards: matrix is the local transformation and worldmatrix is the concatenated one.

local? does is mean parentMatrix? then what about parentMatrix?

local means relative to its direct parent.
world means relative to world (aka relative to the sum of every parents).

well, there’s no matrix named “local” in the list of attrs. if by local we mean parentMatrix, then what would be the difference between matrix and parentMatrix attrs? The matrix “Matrix” is the local one

what is “parentMatrix”?

I guess all you need is in the node documentation:

• `matrix`: Local transformation matrix for the dagNode.
• `worldMatrix`: 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’ 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.
• `parentMatrix`: The parentMatrix instanced attribute represents the world-space transformation matrix for the parents of this dagNode. If the dagNode is a transform node and its inheritTransform attribute is false, then the parentMatrix is identity.
3 Likes

I went over it before creating the topic but somehow i get it better now. thanks

I’ll ask my question here. How to set matrix attributes e.g worldInverseMatrix. In pymel there is a handy command `object.setMatrix(matrix)` . I understand that this is wrapped `cmds.xform()`. Is there a way to set this attributes using general rule?

`cmds.setAttr("object.attribute", value)`

If its a complex attribute you’ll need to specify type. In PyMel:

`pymel.core.general.setAttr(attr, *args, **kwargs)`

1 Like