get world position from matrix

get world position from matrix

egoldid1
Advocate Advocate
2,332 Views
1 Reply
Message 1 of 2

get world position from matrix

egoldid1
Advocate
Advocate

hello.
Suppose I have local position and rotate and scale of child node, I also have world position and rotate
 and scale of parent node.

now How can I have local matrix of child and parent world matrix? and From these two matrices, I get the child world matrix and world position and rotate of child node؟؟؟
please help me. thanks!

0 Likes
2,333 Views
1 Reply
Reply (1)
Message 2 of 2

jmreinhart
Advisor
Advisor

Your question is very hard to understand but here is some info.

 

You can use the "composeMatrix" node to turn a set of transforms (translate, rotate, scale , shear) into a matrix. 

If you do this with the local transforms of an object the resulting matrix will be the "local matrix".

The local matrix is stored on the "matrix" attribute on all transform nodes.

 

To get the worldMatrix of an object you need to multiply the matrix of that object by the matrix of all the objects above it in the heirarchy. So if the heirarchy is 

 

A

-B

--C

---D

 

then you would do:

 

D.matrix * C.matrix * B.matrix * A.matrix = D.worldMatrix

 

BEWARE: the order matter when multiplying matrices.