Sign in to follow this  

Rotation with two axis.

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

Hey guys :) i found some intresting posts in this website and decided to register. i dont like being rude but i would like to ask something :) i have my little object with a dummy object which is followed by the camera(camera will always look at the object's back no matter where it is). it works fine with one axe, but when i tryed adding another one(using D3DXMatrixRotationYawPitchRoll) i got some weird result as shown in the video : http://www.youtube.com/watch?v=d5L74_MDgW0 after hours of work full of pain and blood, i managed to reach the next conclusion : its probably the camera! even though its probably is the camera(or the yawpitchroll function) i cant realy seem to find what i did wrong there. would anyone mind to help me :)? here's a piece of code from my camera function :
D3DXVECTOR3 Target(0, 0,0);
 D3DXVECTOR3 sac(0, 300,0);
 D3DXVECTOR3 m_UpVector(0, 0, -1);
 D3DXMATRIXA16 m_View;
  D3DXMATRIXA16 camfix;
 

  D3DXVec3TransformCoord(&cam,&sac,&MainPlayer->Rotation);
//if(cam.y < 0){m_UpVector.z = 1;}//ignore this. probably useless
 D3DXMatrixLookAtLH(&m_View, &cam, &Target, &m_UpVector);
 D3DXMatrixTranslation(&camfix,-MainPlayer->x,-MainPlayer->y,-MainPlayer->z);


 p_dx_Device->SetTransform(D3DTS_VIEW, &(camfix*m_View));
and my object's matrix :
  D3DXMatrixTranslation(&Cordinates,x,y,z);    // translation matrix
     D3DXMatrixRotationYawPitchRoll(&Rotation,roty,rotx,rotz);
	   D3DXMatrixScaling(&Scale,scalex,scaley,scalez);    //rotation matrix
   p_dx_Device->SetTransform(D3DTS_WORLD, &(Scale*Rotation*Cordinates)); 
sorry for the bother, i will realy appreciate help :)

Share this post


Link to post
Share on other sites
well after years of hard work i managed to find the problem
rotx*roty*rotz is not the same as YawPitchRoll and this caused me the problems. well thanks for entering :)

Share this post


Link to post
Share on other sites

This topic is 3297 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this