#### Archived

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

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

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

## 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 on other sites
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 on other sites
It''s that simple trig functions i''m actually on the look for.

##### 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 on other sites
Thanx alot "Advanced Bug", it works great now! Appreciate it!

##### 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 on other sites
Heh.. It worked before, so. Hmm.. But thanx

1. 1
Rutin
25
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633310
• Total Posts
3011304
• ### Who's Online (See full list)

There are no registered users currently online

×