Novel Collision Approximation
Game engines use state to handle collisions, constantly updating the positions of particles until a collision is detected. This approach is logical for games because graphics are displayed chronologically, but this isn’t necessarily the best system for education-oriented physics simulations, as to get the state for a time far in the future we’d need to simulate all ticks up until that point. Instead, we can use a little bit of math to create a stateless and functional approach to collision simulation.
To demonstrate, I use algebra to calculate the range of times when two particles can collide on the x axis, and use these bounds to calculate the specifics of potential collisions.
The first step is to isolate t in the following equation, which is the solution for all times two point masses will collide on the x axis given uniform acceleration.
After a massive amount of algebra, this gives us:
To account for radii, we modify the first equation to the following:
And now get the following when isolating for t:
Now we know that if the two particles collide, it will be some time (inclusively) between the two t values. This is done with virtually no computational burden. To account for an N-dimensional systems, we repeat the process N times and brute force the solution in the intersection of time intervals.
What are the consequences of this? That is left as an exercise for the reader.