Public Group

# Transforming a object to another coordinate system

This topic is 1180 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have object A and object B, and the world matrix for object B is 6 units along the positive x axis. From what I have read if I transform object A using the inverse of object B's world matrix, it will be transformed to object B's coordinate system. Why is that? Does it mean object A's vertices are now defined relative to object B's origin(0,0,6)?

##### Share on other sites

If you transform a coord using inverse of a world matrix then you get the coord local space of this world matrix.

It's like if one person see a point and another person see the same point, you got different coord based on them.

##### Share on other sites

It is basically as you say. If two objects, A and B both have a point at (0, 0). You move object B across by 6 so it's point is now at (6, 0) then relative to that, A's (0,0) is actually at (-6, 0) relative to B but in 'world space' it is still (0, 0). If you invert B's transform you get -6 translation. You apply that to A and now A's (0, 0) is now at (-6, 0) so it makes sense if that's then in 'B' relative space.

It is quite confusing. As long as you understand what space you are working in and that the space is the same then you are good.

Edited by Nanoha

##### Share on other sites
Instead of calling it the "world matrix", I like to call if the "object to world matrix" -- transform matrices are constructed to move from one space to another. Both spaces should appear in the name so the purpose of the transform is clear.

So you've got an "A->World" transform and a "B->World" transform.
Also "Inverse(B->World)" is equal to "World->B".
So "A.world * inverse(B.world)" is actually:
"A->World, World->B", or "A->World->B", or "A->B".

Likewise the "view matrix" is actually the "world to view matrix" and "projection" is "view to projection".
"WorldView" is "object to world to view" or "object to view", and "WorldViewProj" is "object to projection".

##### Share on other sites

Instead of calling it the "world matrix", I like to call if the "object to world matrix" -- transform matrices are constructed to move from one space to another. Both spaces should appear in the name so the purpose of the transform is clear.

So you've got an "A->World" transform and a "B->World" transform.
Also "Inverse(B->World)" is equal to "World->B".
So "A.world * inverse(B.world)" is actually:
"A->World, World->B", or "A->World->B", or "A->B".

Likewise the "view matrix" is actually the "world to view matrix" and "projection" is "view to projection".
"WorldView" is "object to world to view" or "object to view", and "WorldViewProj" is "object to projection".

I like that idea. Certainly is easier to remember what's going on. I think I may adopt the approach.

##### Share on other sites
Instead of calling it the "world matrix", I like to call if the "object to world matrix"

A good option to have it working for all space is to use "Global Space", it works for world space and model space.

Edited by Alundra

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
634142
• Total Posts
3015764
×