Since my last blog post, I have fixed the issue with the ball gaining speed, added in a spring system, and created a fun little demo to show what the engine currently does.
The issue with the balls gaining speed in the last post turned out to be the sphere to sphere collision resolution I didn’t realise this because the 2 sphere’s didn’t collide often, the cause was my elasticity calculations, but that’s been fixed up now.
The Spring System:
The spring system works by setting up an object with a resting distance, a spring constant, and pointers to the 2 objects you want to connect to one another, once that is set up the update function calculates the distance between the 2 objects, minus’s the resting distance from that, and multiplies it by the spring constant, that result is then applied as a force to each ball in the direction toward the other ball. Keeping the balls in place, or moving them back into place in a springing motion if they’ve been displaced.
