P.S.

In the simplest case, equal  masses, just interchange the velocities of the two 
balls after the collision.

Proof:
If one assumes that the solution is unique, and since interchanging the 
velocities conserves momentum and energy (for balls of equal mass), this 
solution is THE solution.

Jim

> Richard,
> 
> Collision detection is the easier part. Just calculate the distance between 
> centers and, if it is greater than the sum of the radii (assuming they are 
> circular) you have a collision.
> 
> The more difficult part is the physics, what happens after the collission. 
> Are they of equal mass and size? You need to conserve momentum and energy.
> 
> To get started you may  look at a pool game. See:
> 
>     http://jamesphurley.com/runrev.html
> 
> and look for "Nine ball pool."
> 
> You may  want to also checkout "Bouncing ball tools" at the same site to see 
> how to work with collision with different shapes, and how to deal with 
> enclosures that are may  be convex.
> 
> Jim Hurley
> 
> 
> 
> 
>> I'm working on a very simple iPad app where 4 large shapes randomly float 
>> around on the screen.  What I'd like to do is have them be able to bounce 
>> off each other if they happen to touch.  Are there any tutorial pages or 
>> sample stacks out there that anyone knows of that I could use as a starting 
>> point?  I can do collision detection with intersect, but before I spend 
>> countless hours reinventing the wheel, I thought I'd ask.
>> 
>> ---
>> Richard MacLemale
>> Music = 
>> http://www.richardmac.com
>> 
>> Programming = 
>> http://www.macandchee.se
> 

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to