Sign in to follow this  
DarkEvilOne

Rotating a 3d model

Recommended Posts

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 :)

Share this post


Link to post
Share on other sites
SetTransform(D3DTS_WORLD,&rotation_matrix);

Basically thats it. :)

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

Share this post


Link to post
Share on other sites

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