Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

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

share|improve this question
up vote 2 down vote accepted

I believe this article will be of some help to you. It has sample code that will show you how to rotate the points on a rectangle but also show you how to use the separating axis theorem to detect collisions on a rotated shape (in this case your collision box). On a side note, the web site is also a great resource for learning XNA.

One other solution might be to use a few points (instead of rectangles) that change when the animation changes. Then use those points to detect collisions. I've heard of storing these points alongside animation frame data in an .xml file. Might make for a simpler approach than using the separating axis theorem. Hope this helps. Good luck.

share|improve this answer

use a bounding circle instead with the 0-90 degree angle being the distance you can slash vertically for example.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.