Jump to content
  • Advertisement
Sign in to follow this  
lucky6969b

Why rotation of 1.57 radian in x would face downwards?

This topic is 866 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

D3DXQuaternionRotationYawPitchRoll(&quatRot, rot.x, rot.y, rot.z);
D3DXMatrixTransformation(&matWorld, &scaleCenter, NULL, &scale,    NULL, &quatRot, &pos);

The object local axis aligns to the world axis,
that is the front of the object is facing positive x
and I give this direction facing right.
yet, +ve x in the world is facing right.
But When I rotate the object by rot.x of 1.57 radian, it is facing downwards...
Why not facing upwards? I don't get it

Does it mean the directx coordinate is left-handed, so that a positive turn is clockwise?
Thanks
Jack

Edited by lucky6969b

Share this post


Link to post
Share on other sites
Advertisement

So I've checked,

In DirectX,

The yaw (around y-axis) of radian 1.57 is indeed facing down,

and radian of 4.7 is facing up?

 

To fastcall22,

Actually I've put up a D3DXVECTOR3(1.57,0,0) in the rotation variable

and aggregate in this call, so the x element of the rotation variable is still referring

to the yaw in the D3DXQuaternionYawPitchRoll call (around y-axis)

 

How can I make the DirectX turns follow the radian compass?

that is with a left-turn (anti-clockwise) to have positive radian?

 

Update:

Okay,

a few hacks, I made the model facing left when exporting,

so 1.57 is facing up now

 

But 3.14 is facing right now, because increasing radian is still taking clockwise turn, quite hairy...!

 

Thanks

Jack

Edited by lucky6969b

Share this post


Link to post
Share on other sites

the directx coordinate is left-handed

 

by default, yes.

 

 

 


How can I make the DirectX turns follow the radian compass?
that is with a left-turn (anti-clockwise) to have positive radian?
 

 

new_rotation = (2 * pi) - old_rotation

 

so if you want to turn 1.57 left, you new rotation is 2pi-1.57 = 3pi/2 (90 degrees left, the long way around)

 

a similar fixup is required to convert a unit circle heading (IE atan) to the compass heading for a target. the first is measured counter clockwise from the positive x axis, while the second is measured in a clockwise direction from the positive z direction (in a 3d game w/ left hand coordinate system, and in the positive y direction on the unit circle).

 

 

you may also find life goes easier if you define local positive z to be forward, local positive y as up, and local positive x as right, both in the game, and when you export. then everything matches dx's default left hand system.

Edited by Norman Barrows

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!