This topic is now archived and is closed to further replies.


how to calculate the collision of the ball

Recommended Posts

When the ball hits a wall that is parallel to one of the axis its quite obvious:

negate the according speed value.
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]

Share this post

Link to post
Share on other sites