Consider the following setup: object A contains object B, which contains object C.
All objects have local position, scale and rotation. They calculate a local matrix + world matrix, where ‘world matrix’ is the combination of their own local matrix and their parent matrix.
For example, object C’s world matrix is its C.LocalMatrix * B.WorldMatrix.
B’s World Matrix would be B.LocalMatrix * X.WorldMatrix and so forth (until we get to a parentless object that just return local matrix as world matrix).
Or in other words, C’s final world matrix is:
A.LocalMatrix * B.LocalMatrix * C.LocalMatrix.
Now if I want to set C’s position in final world space.
For example, I want to be able to do this:
C.Position = new Vector(10, 10, 10);
and C’s world matrix position would be exactly 10,10,10, regardless of A and B’s transformations, or even own C’s rotation / scale.
If you’re familiar with Unity - basically I’m asking how they set objects world position
Edit: just to be clear, I’m not only interested in setting the final world matrix position, that would be easy I want to actually calculate and store the local position value after setting the world position, since I want to be able to set both world position and relative local position…