• Advertisement
Sign in to follow this  

Maybe a dumb question....but.....

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

I need some help. It may sound quite dumb (although I hope not!). Im having trouble with multiple rotations on a single object. I need to rotate an object in both the x and y planes (ie. so its rotations are 'up and down' and 'side to side'). I can get one or the other to work, but not both. Basicially what I have is this: D3DXMatrixTranslation(&matTrans, pos.x, pos.y, pos.z); D3DXMatrixRotationY(&matRotate, D3DXToRadian(facing.y)); D3DXMatrixMultiply(&matTrans, &matRotate, &matTrans); and then the render call. If I add the D3DXMatrixRotationX(...) it just uses the one called last. Any help would be awesome.

Share this post


Link to post
Share on other sites
Advertisement
Hi, well not sure if this is the correct answer but as I remember the order in which the matrices are concatenated affect the final matrix, so you could try multiplying in a different order like:

D3DXMatrixTranslation(&matTrans, pos.x, pos.y, pos.z);
D3DXMatrixRotationY(&matRotate, D3DXToRadian(facing.y));
D3DXMatrixMultiply(&matTrans, &matTrans, &matRotate);

Or if you are using C++ you could simply use:
matTrans = matTrans * matRotate;

Hope this helps you,
Oscar

Share this post


Link to post
Share on other sites
I bet the problem is simply that you are getting the parameters mixed up. Why do you put the result of the multiplication back into matTrans (for example)?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement