I've been looking into these collisions again, not with the intentions of being used in this project but feel free to use anything if you want (although it's still not working).
For this I've made some assumptions so please tell me if anything at all here is wrong.
1. The velocities of the balls along the tangent to the collision normal do not change.
2. The speed and direction of the combined centre of mass of both balls is the same before and after the collision
3. The speed at which the balls travel away from each other after the collision is equal to the speed at which they travelled towards each other before the collision.
I'm pretty certain about 1 and 2 but not so sure about 3.
from that, I've come up with this test in blitz.
Graphics 800,600,32,2
x1#=300:y1#=300
vx1#=40:vy1#=20
x2#=310:y2#=295
vx2#=-20:vy2#=40
Repeat
;read start position of ball1 from mouse coords
vx1#=300.0-MouseX()
vy1#=300.0-MouseY()
;get the collision normal and tangent
nx#=x2-x1
ny#=y2-y1
l#=1.0/Sqr(nx*nx+ny*ny)
nx#=nx*l
ny#=ny*l
tx#=ny
ty#=-nx
;get the tangent component of each balls vector
vp1#=vx1*tx+vy1*ty
vp2#=vx2*tx+vy2*ty
;write the tangent component into variables for the result
rx1#=vp1*tx
ry1#=vp1*ty
rx2#=vp2*tx
ry2#=vp2*ty
;find the centre of gravity of both balls combined
;the direction and speed of the centre of gravity should be constant before and after the collision
cx#=((vx1)+(vx2))*.5
cy#=((vy1)+(vy2))*.5
;get the initial distance apart
;they should be travelling apart After the collision at the same rate they travelled towards each other before
rad#=Sqr(((vx1)-(vx2))^2.0+((vy1)-(vy2))^2.0)*.5
;calculate where on the circle edge (radius from centre of gravity) the line is for v1
dot#=tx*(rx1-cx)+ty*(ry1-cy)
dis#=-Sqr(rad*rad-dot*dot)-(nx*(rx1-cx)+ny*(ry1-cy))
rx1#=rx1+nx*dis
ry1#=ry1+ny*dis
;and same for v2
dot#=tx*(rx2-cx)+ty*(ry2-cy)
dis#=Sqr(rad*rad-dot*dot)-(nx*(rx2-cx)+ny*(ry2-cy))
rx2#=rx2+nx*dis
ry2#=ry2+ny*dis
;draw test
Color $ff,$ff,$ff
Line x1,y1,x1-vx1,y1-vy1
Line x2,y2,x2-vx2,y2-vy2
Text 50,50,"total v before:"+(Sqr(vx1^2+vy1^2)+Sqr(vx2^2+vy2^2))
Color 0,0,$ff
Line x1,y1,x1+rx1,y1+ry1
Line x2,y2,x2+rx2,y2+ry2
Text 50,70,"total v after:"+(Sqr(rx1^2+ry1^2)+Sqr(rx2^2+ry2^2))
Flip
Cls
Until KeyDown(1)
End
But the sum of the velocities before and after the collision vary quite a lot and I have no idea what else to try as this all fits with the assumptions I've made.