Jump to content
  • Advertisement
Sign in to follow this  
Dark Metamorphosis

is the rotation of the object and its world matrix inversed?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, I want just to make sure of something. the world cartisien place in direct 3d (directx 9.0) is left Handed. however the D3DXMATRIX axises act really weird, it seems that the x and z axis are flipped, and the illustration of the axis in the D3DXMatrixRotationYawPitchRoll, and the Dx documentation shows a right handed axis, any way, is there somthing special about the D3DXMATRIX or not? [Edited by - Dark Metamorphosis on January 12, 2005 3:53:40 PM]

Share this post


Link to post
Share on other sites
Advertisement
as far as i know, unless you specify otherwise,

X to the right
Y to the up
Z to the towards you.

ace

Share this post


Link to post
Share on other sites
so the world matrix, for which the elements: mat._41, mat._42, mat._43, are in left handed cartesian plan, (x to the right, y up, z towards to secreen).
and for the elements of the X, Y, Z axis, the cartesian plane is right handed, (x to the right, y up, z towards me).
but in the case this is true. why such a complication?

Share this post


Link to post
Share on other sites
D3D is left-handed. The diagram is poorly drawn and/or you are misinterpreting it.

Also, D3D uses row vector notation:

v' = vM

ace_lovegrove is wrong. He is describing a right-handed system (such as OpenGL).

Share this post


Link to post
Share on other sites
Ok, I know that d3d uses a left handed CP (Cartesian Plane), but there is still something wrong whith the world matrix, I'll explain:
-I set up the camer as:
UP(0, 1, 0), EyePosition(0, 0, -4), EyeTarget(0, 0, -3)
-I made a Quad for which the vertex Cordinater are:
(-1, -1, 0), (-1, 1, 0), (1, -1, 0), (1, 1, 0)
-for the projection matrix it is default (as shown in the directx tutorials)
-mat_world is the world matrix and it is set to identity.

*now I see this:
_____
| |
|_____|

and since the we are using a left handed CP, the axis in world matrix should be as follow:
Y(0, 1, 0)
| / Z (0, 0, 1)
| /
|/______ X (1, 0, 0)

now here is what I do, I want to rotate the world matrix by D3DX_PI/4
D3DXMATRIX mat_Temp ;
D3DXMatrixRorationY(&mat_Temp, D3DX_PI/4) ;
D3DXMatrixMultiply(&mat_World, &mat_World, &mat_Temp) ;

the object being rendered rotates correctly:

/|
/ |
| |
| /
|/

however when I check the axis coordinate in the world matrix:
X (0.707, 0, -0.707)
Y (0, 1, 0)
Z (0.707, 0, 0.707),
and that is wrong, because it should have been
X (0.707, 0, 0.707)
Y (0, 1, 0)
Z (-0.707, 0, 0.707),
(look ate the world axis illustration above, and rotate them by D3DX_PI/2)

and one more thing, the implementation for the Y-Rotation is:
mat._11 = cosf(ang)
mat._13 = -sinf(ang)
mat._31 = sinf(ang)
mat._33 = cosf(ang)

but this is taking a right handed CP, shouldn't it be for a Left handed CP this:
mat._11 = cosf(ang)
mat._13 = sinf(ang)
mat._31 = -sinf(ang)
mat._33 = cosf(ang)

any I am so confused, and the only thing I can see, is that the position follows as LCP, but the coordinates of the X, Y, Z axis and the matrix follows a RCP. could somebody tell me what's wron here please?
thank you all.

[Edited by - Dark Metamorphosis on January 11, 2005 2:24:59 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Dark Metamorphosis
... however when I check the axis coordinate in the world matrix:
X (0.707, 0, -0.707)
Y (0, 1, 0)
Z (0.707, 0, 0.707),
and that is wrong, because it should have been
X (0.707, 0, 0.707)
Y (0, 1, 0)
Z (-0.707, 0, 0.707)
...
Assuming that you mean PI/4 when you write PI/2, the D3D results are correct and the results you expect are not.

Share this post


Link to post
Share on other sites
if the D3D result are ok, then there is something wrong here. because the quad I rotated became like this:

..../|..
.../.|..
../..|..
..|../..
..|./...
..|/....

the left side of the quad moved back, while the right side moved forth.
(forth and back in the dimension of the world Z axis)

however the World matrix Left Handed Cartesian Plane became like this:

Y(0, 1, 0)
|....
|../Z(0.707, 0, 0.707)
|./..
|/...
.\...
..\..
...\X(0.707, 0, -0.707)

the left side moved forth, and the right side moved back.

-and other words this means that the sense of rotation of the actual object/scene, and the Cartesian Plance of the world matrix (X, Y, Z axises) is the opposite of each other. is this right?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!