2D Collisions
the search is down..
lets say i have two objects moving around, with given speeds and angles
P1, speed 5, angle 70
P2, speed 7, angle 166
and these two objects collide, what are the equations to determine the new speed and angles.. i know it has somethign to do with m1v1+m2v2=m1V1+m2V2 but i cant seem to work out the formulas..
thanks
L
This is 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
(its better to store velocities in (vx, vy) form - it saves lots of conversions)
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 / (sqrt(dx * dx + dy * dy))
ry = dy / (sqrt(dx * dx + dy * dy))
k = 2 * (rx * (v2x - v1x) + ry * (v2y - v1y)) / (m1 + m2)
Updating velocities:
v1x += rx * m2 * k;
v1y += ry * m2 * k;
v2x -= rx * m1 * k;
v2y -= ry * m1 * k;
Initial data:
v1x, v1y - x and y components of first ball velocity
v2x, v2y - x and y components of second ball velocity
(its better to store velocities in (vx, vy) form - it saves lots of conversions)
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 / (sqrt(dx * dx + dy * dy))
ry = dy / (sqrt(dx * dx + dy * dy))
k = 2 * (rx * (v2x - v1x) + ry * (v2y - v1y)) / (m1 + m2)
Updating velocities:
v1x += rx * m2 * k;
v1y += ry * m2 * k;
v2x -= rx * m1 * k;
v2y -= ry * m1 * k;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement