Advertisement

how to calculate the collision of the ball

Started by January 29, 2003 01:09 PM
1 comment, last by kopyaso 22 years ago
how to calculate the collision of the ball when it is collided
What kind of ball? Against what? Details, please...

It is coming...8 years in the making and It is finally coming...

-Beavt8r
It is coming...10 years in the making and It is finally coming-Beavt8r...
Advertisement
When the ball hits a wall that is parallel to one of the axis its quite obvious:

negate the according speed value.
example:
Ball with speed (vx, vy, vz) hits bottom or ceiling:

vy *= -1;

When a ball hits another ball, there are two cases:

1) central hit
2) decentral hit (as used in billard to do fancy shots)

Since the decentral hit obviously needs a doctorand in physics (as i was told) to be calculated, i'll just tell you the equitation for the central hit. (which still looks nicely)

Assume, that you have the vectors v1, v2 : (vx, vy, vz) which are the speed of the balls.
Further you have the masses m1 and m2 of your balls.
Then the new speed values are as following:

v1 = v1 * (m1 - m2) / (m1 + m2) + v2 * (2 * m2) / (m1 + m2);

v2 = v1 * (2 * m1) / (m1 + m2) + v2 * (m2 - m1) / (m1 + m2);

[edited by - Christian Schlager on January 29, 2003 4:01:27 PM]

This topic is closed to new replies.

Advertisement