Sign in to follow this  

2D Sprite Rotation & Bounding Boxes

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

This topic is 4715 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.

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