This project is read-only.

World Coordinant system vs Object Coordinant system

Oct 6, 2009 at 11:37 PM
Edited Oct 7, 2009 at 4:12 PM

Is there any way I could convert a nodes matrix to a matrix based on another node. 

For example, I want to know the x and y axes or an object based on the x and y axis of the ground node.  To tell how a marker is positioned and rotated compaired to the ground marker.  Rather then how a marker is rotated in the world.  Make sense?

I know in the leadwerks engine you can use TFormPoint to convert the coordinant system to the system from another object.

Look at it this way, lets say I have 2 markers, Ground and Toolbar1, I want to have a 3d object located at the Toolbar1 location, but rotating on the Ground Y axis. How would I do that?

Oct 7, 2009 at 4:12 PM

Assuming the transformation of the ground node is G, and the transformation of another node is A. 

Then you want to know the transformation X that would transforms from G to A, which means the equation G * X = A would hold.

Then, you can tweak the equation to get X = inverse(G) * A. In XNA, the matrix computation would actually be A * inverse(G).


Oct 7, 2009 at 4:36 PM

That worked, Thank you

One of these days i will get my head wrapped around the Matrix, and how it works.

I did find this post in the XNA forums, it helps abit. 

"What a matrix does is describe converting from one 'coordinate space' to another. This could simply mean 'how to go from here to there' or it could be something more complex.

An example would be a tank. You can have a matrix to describe the position/rotation/scale of the tank. ('tank space'). The vertices for the tank's mesh will be stored in 'tank space', as will things like the centre point of the gun turret, etc. No matter where in your game that tank may be (which is defined by it's matrix), those values describing it will not have to change. If you wanted to know where those points were in world space, you would multiply them by the tank matrix. By this definition, the matrix for the tank describes converting from 'tank space' to 'world space'.

Going back to the gun turret on the tank, if the gun turret is '1m above the centre of the tank', then the matrix for that turrent simply translates +1m on the y axis - the important point is that the turret matrix converts from turret space to tank space (in that order!). So no matter how the tank rotates or moves around, the turret is always 1m above it. (Then to rotate the turret left/right, just rotate it's matrix around the y-axis - this could be another matrix 'turret rotation space'.). To convert directly from turret space to world space you get the matrix: (tank space) * (turret space). (This heirachy can go as deep as you want).

Also note that matrix1*matrix2 != matrix2*matrix1; think of the tank example, and what each matrix represents and this should become clear.".

However, I still dont get what adding, subrtracting, Multiplying, and Inverting a matrix with another matrix does exactly.