Colliding balls.

Started by
12 comments, last by marinka 22 years ago
I believe the solution to this problem
involves transforming into a coordinate system
defined by the tangent plane between the
balls and the normal axis (center-to-center).

The velocities in the tangent directions are
unchanged, and in the normal direction the velocity
components are solved just like the 1D conservation
of momentum case above.
GameDev Reader TODO List:1. Name my company.2. Buy domain name.3. Create web site.4. Name myself as CEO5. Create Game Engine.6. Design game.
Advertisement
marinka:
In your message you describe the two balls as _moving_ on a plane, but if you''re thinking of something like a pool table or pinball you really should think of the two balls as _rolling_ on a plane surface, and include conservation of angular momentum in your calculations.

From my physics book:

L - Angular momentum
I - Moment of inertia
K - radii of gyration
w - angular velocity

L = I*w
I = m*K*K, m is mass
K = 2*R*R/5, for sphere of radius R
w = v/(2*pi*R), --"--

Sum of L should be the same before and after the collision:

L1 + L2 = L1'' + L2''




---------
"It''''s always useful when you face an enemy prepared to die for his country. That means both of you have exactly the same aim in mind." -Terry Pratchett
---------"It''s always useful when you face an enemy prepared to die for his country. That means both of you have exactly the same aim in mind." -Terry Pratchett

Forgot the direction of angular momentum. It will be parallel to the axis of revolution, pointing to the lefthand side when you''re facing in the direction of movement.
---------"It''s always useful when you face an enemy prepared to die for his country. That means both of you have exactly the same aim in mind." -Terry Pratchett
Dot(v1, v2) is the scalar product, often called Dot Product.
Cross(v1, v2) is the vectorial product, the cross product.
I am aware that the scalar product can be used to find the projection of one vector onto another; but it can also be used to find the angle between two vectors.

Dot(v1 , v2 ) = |v1 | * |v2 | * cos(theta)

The derivation for dpE relies on the fact that (everything is scalar here):
v'' ^ 2 = v ^ 2 + dv ^ 2 - 2 * v * dv * cos(theta)
where theta is the angle between v and dv , so
Dot(v, dv) = |v| * |dv| * cos(theta) (all vectors)

So, utlimately, you should find that
cosA = Dot(vA, N) / |vA| (all vectors)
cosB = Dot(vB, N) / |vB| (all vectors)
dpE = 2 * (|vA | * cosA + |vB | * cosB) / (1 / mA + 1 / mB)

As for solving your problem, just plug the numbers into the equations presented here... If the radii are equals, then the point of impact P is
CA = (X1, Y1)
CB = (X2, Y2)
vA = (V1X, V1Y)
vB = (V2X, V2Y)

P = (CA + CB) / 2 (vectors)
N = Normalize(P - CA) (vectors)

Then find dpE using the equations above. Next, use
vA'' = vA + dp * N / mA
vB'' = vB + dp * N / mB
where dp = dpE if your collisions are elastic.

Cédric

This topic is closed to new replies.

Advertisement