Rotating a 3d model
Hey, i've been working on some code which uses D3D9 to load and display a 3ds model. So far everything is good, the code can load the models and display them fine but now i want to allow the models to be rotated/translated/scaled using the keyboard.
I have code which allows the camera to be moved around on the x, y or z axis using the keyboard and the D3DXMatrixLookAtLH() function and then the LPDIRECT3DDEVICE9::SetTransform() function. I'm guessing to rotate a model on the X axis i would use D3DXMatrixRotationX() to create a matrix for the rotation, but then how would i apply this rotation to the 3d model?
Cheers :)
SetTransform(D3DTS_WORLD,&rotation_matrix);
Basically thats it. :)
Oh yeah, you want to render your model after you set the transform, of course.
Basically thats it. :)
Oh yeah, you want to render your model after you set the transform, of course.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement