• Advertisement

Archived

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

(VB) Circle collision reaction.. (short: Billiard)

This topic is 5561 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

How is the easiest way to calculate the result angles in 2 circles colliding? I don''t need any accourate maths'' here, just some simple calculations that makes em bounce off of each other in a fairly realistic way. Hmmm.. Help me!

Share this post


Link to post
Share on other sites
Advertisement
For billiard ball collision coming from different angles, you will need to know their masses, velocities(before collision would be good). Using p = mv you can get each ball''s momentum. You can then use the law of conservation of momentum to calculate their after velocities. However, since I''m assuming your collisions are 2D(x and y coordinates), you will need to seperate your velocities into components and do them seperately, then use basic trig to find the angle after collision.

Share this post


Link to post
Share on other sites
Here''s what I use.


Initial data:

v1x, v1y - x and y components of first ball velocity
v2x, v2y - x and y components of second ball velocity

(You can store velocities as linear speed and angle, but my experience shows that it''s better to store x and y components)

x1, y1 - coordinates of first ball
x2, y2 - coordinates of second ball

m1 - mass of first ball
m2 - mass of second ball

Calculations:

dx = x2 - x1
dy = y2 - y1

rx = dx / (sqr(dx * dx + dy * dy))
ry = dy / (sqr(dx * dx + dy * dy))

[sqr = square root]

k = (rx * (v2x - v1x) + ry * (v2y - v1y)) / (m1 + m2)

Updating velocities:

v1x = v1x + rx * m2 * k;
v1y = v1y + ry * m2 * k;
v2x = v2x - rx * m1 * k;
v2y = v2y - ry * m1 * k;


Share this post


Link to post
Share on other sites
I''m afraid there''s a slight mistake in my post:

k = (rx * (v2x - v1x) + ry * (v2y - v1y)) / (m1 + m2)

I think it must be:

k = 2 * (rx * (v2x - v1x) + ry * (v2y - v1y)) / (m1 + m2)

for elastic collisions, but I''m not sure.

Share this post


Link to post
Share on other sites

  • Advertisement