Jump to content
  • Advertisement
Sign in to follow this  
Swarmer

Manipulating models seperately

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

Hi, I'm fairly new with DirectX. I'm trying to load multiple .x models and rotate or translate them seperately from each other. I used the code from here: http://www.gamedev.net/reference/articles/article2079.asp I modified it so now I can load multiple models; however, when I try to rotate one, it rotates all of them at the same time. I think I need a better explanation on the concept of using a Direct3Ddevice. Is it the object that handles the graphics related things? Or is it the world in which I render things? So far my program is rotating the world matrix and transforming it like this: D3DXMatrixRotationY( &matYWorld, D3DXToRadian(fAngle1)); D3DXMatrixRotationX( &matXWorld, D3DXToRadian(fAngle2)); D3DXMatrixRotationZ( &matZWorld, D3DXToRadian(fAngle3)); D3DXMatrixTranslation(&matTranslate, 0.0f, fUp, fForward); matWorld = (matYWorld * matXWorld * matZWorld * matTranslate); g_pd3dDevice->SetTransform(D3DTS_WORLD, &matWorld); I'm pretty sure there's nothing wrong there. But am I missing something conceptually when using multiple models? Does SetTransform move the whole world around, or just the model? Thanks in advance for any help!

Share this post


Link to post
Share on other sites
Advertisement
SetTransform sets the transformation matrix for anything rendered from the point it is called until it is called again with a new value. At that point, the new value overwrites the old value.

If you want to draw multiple objects at different locations, you'd call SetTransform with the object's transformation matrix, followed by the DrawSubset(s). You'd then call SetTransform and DrawSubset again for each object you'd want to draw, each time overwriting the current World matrix with the value that should be used for the specific object.

Hope this helps.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!