Search code examples
c#xnacollision-detection

Checking collision circle with rectangle with c# XNA 4.0


Like in Title i trying to check collision circle with rectangle with XNA.

But have no idea how to check it simple.

I found something like this tutorial

but i wonder is there any existing solution for my problem in XNA?

I attach the image which showing what i'm trying to check if someone not fallow What I'm trying to do

EDIT: I'm making game for Mobile Windows Phone 7. It should not overload CPU too much.

Thanks for advance:)


Solution

  • Here is an answer to a similar question: Circle-Rectangle collision solution.

    For reference, here's a thread on Moving Collision Detection with a programmer from Griptonite Games (Mike0801). It might be worth reading what he has to say on the maths. They've produced games for power starved machines like the Gameboy, so he gives lots of insight on doing so quickly.