I've choice to write a billiard game for class. All runs ok but I would like to improve realism to ball collisions.
For each ball I have a pygame rectangle, that means, ball center, ball diameter and position in game. And also a velocity vector (u_x, u_y).
At this time I check collision with colliderect, but I can change it measuring center balls distances.
I have read about Conservation of momentum equations but this not have ball positions in consideration. Is not the same two ball frontal impact than a lateral impact.
Someone can help to me in formula for new ball velocities after collision considering ball position at the impact moment. Thanks a lot!
dot
, andboundary_normal
. It is easy for you write python formula from this link? – CrazyHorsedot
refers to the dot product andboundary_normal
is the normal vector at the point of impact. – Bart