Jump to content
  • Advertisement
Sign in to follow this  
DFX

2D Sprite Rotation & Bounding Boxes

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

So, I'm building myself a little 2D sprite engine and I've got the sprite rotating and it all works fine but I need to be able to get the coords for a bounding box around the sprite to be able to do any type of collision detection. To get the Sprite to rotate I create a D3DXMatrix using D3DXMatrixTransformation2D() I then call SetTransform() method from the ID3DXSprite interface. Now I'm assuming somewhere in the returned matrix is the information I need but I'm not sure. If it is, how can I get it? If it's not, how can I calculate this on my own? I've looked all over the web at tutorials with 2D rotations but nothing seems to work. I need to be able to get the top/left most coord and the bottom/right most coord. Can anyone help? Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
Im not sure if the function exists but look into finding the transpose of the matrix. This may help.

ace

Share this post


Link to post
Share on other sites
If you know the original bounding box coordinates, you could just use D3DXVec2TransformCoord() to transform the coordinates of the bounding box into their final position. Use the matrix that you created with D3DXMatrixTransformation2D().

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!