Jump to content
  • Advertisement


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


how to calculate the collision of the ball

This topic is 5654 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What kind of ball? Against what? Details, please...

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


Share this post

Link to post
Share on other sites
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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!