Re: Resolving collisions with HardonCollider
Posted: Fri Jun 05, 2015 5:21 pm
Yes, you understood correctly. It is possible. My comment was not that it was impossible, but that it was too much complexity for very little gain, at least on my mind.davisdude wrote:To solve this, couldn't you just make a line segment from the current point to the predicted next point for each object, and check if those segments intersect? If I understand correctly, that would solve this problem.
A rough list of what's needed:
You must start by "dividing time into frames". You need one method in your "world" which says "a new frame is starting now". You then draw "where all the objects are going" (the segment you mention), in a "physics canvas". On each frame, the canvas is erased.
When you check an object for collisions, you look at the "canvas" to see who it collides with.
Implementing this "canvas" is more complex than when one of the objects is always static. Not only you need a new "intermediate structure". You also need to take into account some picky edge cases: ¿Do you "redraw" parts of the canvas, as the objects "bounce around"?. ¿What happens when A pushes B, B pushes C, and C pushes A again, in the same frame?.
The api gets also more complex. You have extra method that the users have to remember calling (the "A new frame starts" method), and if he doesn't, "phantoms" from previous frames will collide with his objects, but no error will be raised. It also adds complexity on the resolution: Instead of a single displacement vector for a single moving object, you need two.
I personally think it is not worth it.