QUESTION: Given the position, velocity, and acceleration of two balls (Ball#1 and Ball#2). Is there a way to figure out when they will collide?
(The acceleration is constant and caused by friction)
WARNING I'm looking for a function that can take an input of two balls and their properties and then return the time they will collide. I'm not looking for the solution of stepping forward a tiny amount every frame and checking for collision. I want to be able to predict collisions very fast.
WHY?: The purpose is to make a highly efficient and "perfect" 8-ball pool physics engine.
NOTE: I already have a collision response system in place. Calculate x/y point that 2 moving balls will collide. However this method breaks down whenever friction is involved.
WHAT I'VE TRIED: I've tried to solve this problem myself and I will do my best to explain my method below.
To start, I took some help from the kinematic equations and created a function that gives me the position of the balls at any specified time. f(t)=ball position at time t
Then I put the functions for the positions of each of the two balls into the distance formula. The result is a new function that can give me the distance between the balls at any specified time. d(t)=distance between balls
The next step would be to check when the distance is 2r.
so, d(t)=2r
However, The function d(t) is not a simple function. It's a quartic function. d(t) = at^4 + bt^3 + ct^2 + dt + e). This means that I would have to solve a quartic equation to find the point of collision.
I know how to solve quartic functions, but I would rather not. (my program (Scratch) has no way of dealing with complex numbers)
Welp, that's it. I'll be here if you have any questions.