Talk:Jeremy Bateman
From GeoMod
Just to let you know, I think I figured out how to make the balls bounce off of each other. It goes something like this: direction=norm(ball_list[j].pos-ball_list[i].pos)
vi=dot(ball_list[i].velocity,direction)
vj=dot(ball_list[j].velocity,direction)
#impact velocity
exchange=vj-vi
#exchange momentum
ball_list[i].velocity=ball_list[i].velocity + exchange*direction
ball_list[j].velocity=ball_list[j].velocity - exchange*direction

