-fel
2D collision problem
-ddn
The binary interpolation method should work, but there may be a problem with accuracy with integer division (an object moves 15 pixels in 1 frame, hence 7 pixels in 1/2 a frame, 3 pixels in 1/4... May not be a problem tho)
You could also extend your collision detection routine to, instead of simply saying 'yes' or 'no', to specify exactly which polygon edges participated in the collision. If your polys move within certain speeds, this info should be enough to interpolate an approximate collision coordinate.
Another method I just thought of (so have no idea at all about viability) is to extend the poly collision algorithm to return the 1/1000th of a frame segment in which the polys collided... that'd cascade down to the line intersection routine, to handle moving vectors. I'll work this one out on paper and let you know.
Regards,
White Fire
Addit:
I never did find a satisfactory way to handle three-way collisions... the collision time becomes too critical, and do you dynamically recompute the velocity and redetect for purther collisions? Ideal, certainly, but how computationally expensive to be accurate?
[This message has been edited by White Fire (edited August 19, 1999).]
But from thinking about it the binary interperlation is actually the best way, but i would cull down the set of lines to be tested. Also since i wanted to know when 1 vertex hits another line, i would use point to line inclusion tests (when a point is inside of a poly vs outside) instead of line line intersection tests. From a sample of my test collision cases it about 2 lines and 2 points, so its not too expensive. You might want to try that White Fire.
-ddn
-ddn
Not sure about that point-in-poly testing tho... that's basically just a sequence of line segment tests, and I've optimised all heck out of my line testing code (Worst case when lines aren't parallel: 9 additions, 10 multiplications and 2 integer divisions, plus the requisite dozen-odd comparisons and logical ands
Might be interesting to shunt the binary interpolation side of things back into the line intersection code tho, save untold redundant line checks...
Anyway, luck with your project,
White Fire