Applying drag to a collision prediction formula

130 Views Asked by At

I feel like this question might be below the minds of Math StackExchange, but I'll try anyway. (I can understand Math generally, but I'm probably not the caliber of people here.)

I've been working on determining the time at which two objects would collide, if they would at all. I had referenced this thread which was very helpful: https://stackoverflow.com/questions/11369616/circle-circle-collision-prediction

(Oax + t*Dax - Obx - t*Dbx)^2 + (Oay + t*Day - Oby - t*Dby)^2 = (ra + rb)^2

I was able to solve that for t but now I'm wondering how I would best apply drag/friction to it.

If ball1 is traveling at a fixed rate of 9, and ball2 is traveling at 7... this works great. Problem is that if their velocities will decrease over time.. so if we're covering a lot of ground, ball1 will end up traveling at 4 and so the collision result could change.

For example: Ball1 is traveling down a slight slope, gaining speed. Ball2 is going straight and losing speed.

I'm assuming that the part of this formula needing adjustment would be the t*Dax, t*Dbx, t*Day, and t*Dby. These appear to be linear, right? So I would want to replace these with something representing my damping.

There would probably be multiple things determining my damping such as: surface friction and gravity.. or could reference easing equations such as Robert Penner's equations in this file http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js

Anywho, I think I'm on the right track, but I'm not really sure. Looking for some help from the smart minds here.

Thanks!