0
votes

I am new to XNA and I am having problems with collision detection when I rotate my sword. I am using a rectangle bounding box approach and I don't know how I can rotate my rectangle together with the sword sprite.

http://picpaste.com/pics/f10268c108e885498a4ae603ab030a60.1328941784.png

The orange line represents the sword and the blue rectangle represents the bounding box, I want to also rotate my bounding box to the position where the arrow goes.

Any suggestions on how can i solve my problem is really appreciated. Thanks!

1

1 Answers

3
votes

I have a sample showing how to detect rotated rectangle collision, you'll need a similar approach for detecting rotated bounding box collisions.

My sample uses the Separating Axis Theorem which is a very common approach. You can read my sample here on Rotated Rectangle Collision

There's also a ton of fantastic resources out there on helping to try and get a handle on the concept of rotated rectangle collision detection. Here's a few I used in constructing my sample.

http://www.metanetsoftware.com/technique/tutorialA.html http://www.codeproject.com/KB/GDI-plus/PolygonCollision.aspx?print=true

Now that you know the term to search for, you should be able to find even more that meet your learning style.