Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Gaming > Development Programming Misc > Re: Circle - Sq...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 12 Topic 948 of 1002
Post > Topic >>

Re: Circle - Square Collision Detection

by Luc The Perverse <ataylor_no_spa_am@[EMAIL PROTECTED] > Oct 16, 2007 at 08:20 AM

guitarstrummr@[EMAIL PROTECTED]
 wrote:
> Anyone have any quick and simple code for collision detection between
> a circle and a square?
> 

Convert to polar coordinates against the orientation of the square from 
the center of the square to the center of the circle.

Use trig functions to calculate the exit point of the square on the line 
between the two centers and the compare the distances.

I would need to know the orientation and size of your square and circle 
to give hard numbers.

But remember the trick is polar coordinates.

On the other hand if you always know that the circle will intersect a 
horizontal or vertical wall (no corners hitting) then you can just model 
it as the intersection of two squares :)

--
LTP

:)
 




 12 Posts in Topic:
Circle - Square Collision Detection
"guitarstrummr@[EMAI  2007-10-15 20:25:18 
Re: Circle - Square Collision Detection
Luc The Perverse <atay  2007-10-16 08:20:43 
Re: Circle - Square Collision Detection
John Nagle <nagle@[EMA  2007-10-17 02:48:47 
Re: Circle - Square Collision Detection
Luc The Perverse <atay  2007-10-17 00:48:52 
Re: Circle - Square Collision Detection
Miss Elaine Eos <Misc@  2007-10-17 14:35:19 
Re: Circle - Square Collision Detection
John Nagle <nagle@[EMA  2007-10-17 08:09:10 
Re: Circle - Square Collision Detection
Miss Elaine Eos <Misc@  2007-10-17 15:24:12 
Re: Circle - Square Collision Detection
John Nagle <nagle@[EMA  2007-10-18 08:47:04 
Re: Circle - Square Collision Detection
Miss Elaine Eos <Misc@  2007-10-19 02:45:55 
Re: Circle - Square Collision Detection
John Nagle <nagle@[EMA  2007-10-21 04:43:06 
Re: Circle - Square Collision Detection
Richard James <IWillGe  2007-10-19 16:59:54 
Re: Circle - Square Collision Detection
Anton <anton.txt@[EMAI  2007-10-28 22:57:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 4:48:52 CDT 2008.