Members - Reputation: 122
Posted 13 December 1999 - 02:53 AM
__On the top, right there's a search option. Click and enter "collision" for your search work and "Topics" for where to search, then start the search. There's one called "Collision physics", or something like that, that should be more than adequet. You can also check the other results if you still want more info.
Posted 15 December 1999 - 06:13 PM
Moderators - Reputation: 1159
Posted 16 December 1999 - 01:00 AM
personally, i would do it this way...
there could be more, but this simple model will let us do most of the physics we want to, (minus the really icky stuff dealing with spin and rotational effects)
we will further simplify our model by saying that there are no frictional effects.
and so, based on two balls with current positions, and current velocities, we know the following.
at time t, the position of a ball is
x=x0+dx*t, y=y0+dy*t, where x0,y0 is the original position, dx, dy representing the velocity of the ball, and t the time elapsed.
also, we know that the balls collide when the distance between them is the sum of their radiuses.
the distance formula: a*a+b*b=c*c
where a is the difference in x positions, and b is the difference in y positions, and c is the distance
so, for two balls, BallA, and BallB, here are some more equations:
(BallA.Radius+BallB.Radius)*((BallA.Radius+BallB.Radius)=( (BallA.Position.x+BallA.Velocity.x * t)-(BallB.Position.x+BallB.Position.x * t) ) * ( (BallA.Position.x+BallA.Velocity.x * t)-(BallB.Position.x+BallB.Position.x * t) ) + ( (BallA.Position.y+BallA.Velocity.y * t)-(BallB.Position.y+BallB.Position.y * t) ) * ( (BallA.Position.y+BallA.Velocity.y * t)-(BallB.Position.y+BallB.Position.y * t) )
now, you do a lot of expansion, and a lot of plugging and chugging, then you have to solve for t using the quadratic equation. if the solution for t is imaginary, then a collision will never occur. if there is a negative solution, ignore it. only a positive, real solution matters. if you have a positive, real solution, then the collision will occur at that time.
when a collision occurs, assuming a totally elastic collision, impart all of the momentum on one ball on the opposite ball, and the job is done.