Bouncing Ball Algorithm
Does anyone have an algorithm or example code of how to bounce a small ball off of a larger ball (like in a table hockey-style game)?
well i can give you the physics formula for it:
one is inelastic collision when 2 objects collide and stick together
m1*v1i + m2*v2i = (m1 + m2) Vf
vf = (m1*v1 + m2*v2)/(m1+m2)
m1 is mass of object 1 m2 is mass of object 2
v1 and v2 are there velocities
vf is the velocity of 2 objects that collide and stick together
elastic collision is when 2 objects collide and dont stick they have opposite velocities
m1*v1i + m2*v2i= m1*v1f + m2*v2f
.5*m1*v1i^2 + .5*m2*v2i^2 = .5*m1v1f^2 + .5*m2*v2f^2
elastic collision formula can be reduced into different cases
this case is when 2 objects collide and dont stick causing them to move in opposite directions
one is inelastic collision when 2 objects collide and stick together
m1*v1i + m2*v2i = (m1 + m2) Vf
vf = (m1*v1 + m2*v2)/(m1+m2)
m1 is mass of object 1 m2 is mass of object 2
v1 and v2 are there velocities
vf is the velocity of 2 objects that collide and stick together
elastic collision is when 2 objects collide and dont stick they have opposite velocities
m1*v1i + m2*v2i= m1*v1f + m2*v2f
.5*m1*v1i^2 + .5*m2*v2i^2 = .5*m1v1f^2 + .5*m2*v2f^2
elastic collision formula can be reduced into different cases
this case is when 2 objects collide and dont stick causing them to move in opposite directions
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement