Missing Something In Theory

Started by
5 comments, last by GameDev.net 19 years, 5 months ago
Hey, I'm working on a game with a physics mechnic similar to billiards. Here is some info about the physics in the world: - 2D - Everything is based on circle collision - Everything has the same mass - In a collision one of the objects starts at a stand still - There is no friction, or rotation that is relivent Anyway, I working on getting glancing collisions working. I've almost got it figured out but can't make the final leap to completion. Here's what I think so far: Assume we have two circles, A and B. A is moving, while B is at a stand still. When two circles collide, the direction of B becomes the direction component of the vector from the center of A to the center of B. The direction component of A then becomes one that moves along the line perpedicular to the new vector of B. Please correct me if this is incorrect, but assuming it is correct I still have some obvious holes in the theory: a) I don't know the magnitudes of the two new vectors. It seems reasonable to assume that B magnitude will be proportional to the the angle that A hit it on. The more of angle, the less the magnitude will transfer between the two objects, up to the point of a straight on collision in which A would stop dead, and B would continue on as A would have if it never collided with anything. b) Which brings up the next flaw. If A hits B perfectly straight, shooting it off at a 90 degree angle would be wrong. Is this simply accounted for because it has no magnitude, so it doesn't actually move in any direction? c) And finally, how do I know if circle A relects on an angle of 90 degrees or -90 degrees? I'm sure I could figure out an ugly way of determing by looking at where A came from, and where in relation the B's ceneter point it hit, but I'd prefer a cleaner approach. Hmmm... this turned out to be a little longer than I expected. But any help would be VERY appretiated! As you can probably tell, math is not my strong suit, so please keep your answers as lamen as possible! Thanks again, Matt Hughson
__________________________________[ Website ] [ Résumé ] [ [email=contact[at]matthughson[dot]com]Contact[/email] ][ Have I been Helpful? Hook me up! ]
Advertisement
In the real world both total momentum and total energy is conserved with "elastic" collision (which is what you're dealing with). This means, where u1 u2 are the incoming velocity vectors, v1 v2 are the outgoing velocity vectors, and m is the mass of a ball, we have:
Total momentum: u1m+u2m=v1m+v2m
Total energy:
(1/2)m|u1|2+(1/2)m|u2|2=(1/2)m|v1|2+(1/2)m|v2|2

From this and knowing what u1 and u2 vectors are you should be able to work out what the v1 and v2 vectors are. (I think)
My stuff.Shameless promotion: FreePop: The GPL god-sim.
To elaborate: This means that
u1+u2=v1+v2
The sum of the input equals the sum of the output. We know vectors add componentwise, so we end up with two equations in four unknowns:
u1x+u2x=v1x+v2x
u1y+u2y=v1y+v2y
Then you have the energy one that comes down to:
|u1|2+|u2|2=|v1|2+|v2|2
u1x2+u1y2+u2x2+u2y2=v1x2+v1y2+v2x2+v2y2
So we're left with three equations in four unknowns. We need another condition. My physics textbook isn't helping with this extra condition. If you know one of the angles after the collision you could use that as an extra condition.

Hope that helps in some way. [looksaround]

My stuff.Shameless promotion: FreePop: The GPL god-sim.
Quote:Original post by matthughson
When two circles collide, the direction of B becomes the direction component of the vector from the center of A to the center of B. The direction component of A then becomes one that moves along the line perpedicular to the new vector of B.

I think you might have the direction of A right, but for the direction of B you should use the momentum formulae I posted above.

Quote:
a) I don't know the magnitudes of the two new vectors. It seems reasonable to assume that B magnitude will be proportional to the the angle that A hit it on. The more of angle, the less the magnitude will transfer between the two objects, up to the point of a straight on collision in which A would stop dead, and B would continue on as A would have if it never collided with anything.

I think the magnitudes can be determined by the energy equation above.

Quote:
b) Which brings up the next flaw. If A hits B perfectly straight, shooting it off at a 90 degree angle would be wrong. Is this simply accounted for because it has no magnitude, so it doesn't actually move in any direction?

If B was stopped, since it has the same mass A would stop when they collide and would give all its momentum to B. See momentum above.

Quote:
c) And finally, how do I know if circle A relects on an angle of 90 degrees or -90 degrees? I'm sure I could figure out an ugly way of determing by looking at where A came from, and where in relation the B's ceneter point it hit, but I'd prefer a cleaner approach.

Use momentum equations I gave to work out B, since you already know where A will go.

Quote:
Hmmm... this turned out to be a little longer than I expected. But any help would be VERY appretiated! As you can probably tell, math is not my strong suit, so please keep your answers as lamen as possible!

I think I've covered it. Just ask if something needs more explaining. [smile]

EDIT: Minor tweaks to make more sense.

[Edited by - Doc on November 23, 2004 10:05:47 PM]
My stuff.Shameless promotion: FreePop: The GPL god-sim.
Thanks a ton Doc! I'll try implementing those formulas today, and let you know how things work out!

Thanks again!
Matt Hughson
__________________________________[ Website ] [ Résumé ] [ [email=contact[at]matthughson[dot]com]Contact[/email] ][ Have I been Helpful? Hook me up! ]
ok, I got it working, thanks a bunch all!

Incase someone else is looking for answers to the same questions I had, here is a link to a page that really helped me: here

Thanks again all,

Matt Hughson
__________________________________[ Website ] [ Résumé ] [ [email=contact[at]matthughson[dot]com]Contact[/email] ][ Have I been Helpful? Hook me up! ]
People interested in this may also wish to check out the "Pool Hall Lessons" article on gamasutra, which covers pool-ball collision detection and reaction quite well.

This topic is closed to new replies.

Advertisement