Jump to content
  • Advertisement
Sign in to follow this  
Bru

Rotation with two axis.

This topic is 3656 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 :
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
Advertisement
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
Sign in to follow this  

  • 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!