Jump to content
• Advertisement

Public Group

how to Rotate Model

This topic is 2928 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 every one ...

i want to rotate my 3dmodel in roll-pitch-yaw axis

i have just axis(x,y,z) vector and up(x,y,z) vector

so how to rotate my model by axis(x,y,z) vector + up(x,y,z) vector values?

please lookout my simple code...
 D3DXVECTOR3 * axis=new D3DXVECTOR3; axis->x = -0.14; axis->y = -0.99; axis->z = -0.04; D3DXVECTOR3 * up=new D3DXVECTOR3; up->x = -0.99; up->y = 0.14; up->z = 0.07; D3DXMATRIXA16 mWorld; /////////////////////////////////////////////////////////////////// D3DXMatrixLookAtLH(&mWorld,g_Camera.GetEyePt(),axis,up); //////////////////////////////////////////////////////////////////// mWorld *= *g_Camera.GetWorldMatrix(); D3DXMATRIXA16 mProj; mProj = *g_Camera.GetProjMatrix(); D3DXMATRIXA16 mView; mView = *g_Camera.GetViewMatrix(); D3DXMATRIXA16 mWorldViewProjection; mWorldViewProjection = mWorld * mView * mProj; V( g_pEffect9->SetMatrix( g_hmWorldViewProjection, &mWorldViewProjection ) );

is there any way or formula to convert :
[size="1"]axis(x,y,z) & up(x,y,z) vectors to (roll - pitch - yaw) ?

also you know we need use "axis" and "up" vector both together to calculate. because in some direction of y we must change place of x value by z ....

Share this post

Share on other sites
Advertisement

i have just axis(x,y,z) vector and up(x,y,z) vector

What are you representing with these vectors? What is the purpose/meaning of the axis vector? Are you representing the axis of rotation? Have you packed an Euler triplet into a vector? What is the purpose of the up vector? Are you representing the direction the local up axis should map to in world space?

is there any way or formula to convert :
[size="1"]axis(x,y,z) & up(x,y,z) vectors to (roll - pitch - yaw) ?

also you know we need use "axis" and "up" vector both together to calculate. because in some direction of y we must change place of x value by z ....

Technically, given a single fixed axis of rotation vector, and a single localup->worldup mapping, it is possible to solve a unique rotation (unless the fixed axis is perpendicular to localup X worldup), but I am guessing you did not intend this, since you are asking "how to rotate my model by axis(x,y,z) vector + up(x,y,z) vector values?"

An axis vector alone does not define a rotation. You need to also specify the amount to rotate about that angle. See http://en.wikipedia.org/wiki/Axis-angle_representation . Alternatively, see other representations of rotation http://en.wikipedia.org/wiki/Rotation_representation_(mathematics) . Perhaps you were looking to generate a LookAt matrix here? ( http://stackoverflow.com/questions/349050/calculating-a-lookat-matrix ).

Share this post

Share on other sites

• Advertisement
• Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• Advertisement

• Popular Now

• 13
• 30
• 9
• 16
• 12
• Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!