Rotating a 3d model

Started by
1 comment, last by DarkEvilOne 19 years, 8 months ago
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 :)
Advertisement
SetTransform(D3DTS_WORLD,&rotation_matrix);

Basically thats it. :)

Oh yeah, you want to render your model after you set the transform, of course.
Cheers :)

This topic is closed to new replies.

Advertisement