We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Collision Detection
Page Index Toggle Pages: 1
Collision Detection (Read 985 times)
Collision Detection
Jul 19th, 2009, 2:47am
 
Hello everyone.I want to draw 3 circles,A B and C,where I can drag A with mouse,pull A to B to boost B and then make it push C.I tired a few times to design but failed.How to make a realistic collision detection model in achieving the effect?Could you show me some code or references?Thank you.
Re: Collision Detection
Reply #1 - Jul 19th, 2009, 2:56am
 
Collision detection of circles is quite simple: you just check that dist() between two center of circles is below the sum of their radii.
Re: Collision Detection
Reply #2 - Jul 19th, 2009, 3:26am
 
I used some physics principles learnt in high school,but in coveying the motivation energy of one circle to all its indirect neighbours(its neighbours's neighbour),it seemed not very easy in code implementation. SmileyThis problem is theoretically easy...And I think perhaps I need some tec of multiple threads... Could you show a reference?Thank you.
Re: Collision Detection
Reply #3 - Jul 19th, 2009, 3:31am
 
You don't really need multiple threads there.
It depends if you want to do all the work yourself or are mostly interested by a result. In the latter case, you can check BoxWrap2D (search it in the forum), it would do all the energy/restitution stuff for you.
Page Index Toggle Pages: 1