3 ms·
Contact generation is the process whereby, after a collision is detected, the points of contact are defined, which are necessary to simulate collision response(
by chipsy 16y ago
Contact generation is the process whereby, after a collision is detected, the points of contact are defined, which are necessary to simulate collision response(responses themselves are anything from a simple separation of the bodies to an in-depth physics sim).
In the most naive form of contact generation, you move the bodies, let them intersect each other, and only afterwards do something to remove them by finding the points of intersection after they've already interpenetrated. Even with simple situations, this is the source of numerous glitches, and makes physics sims unstable, since the two interpenetrating bodies will both see that they're "inside" each other, create forces to get out the situation, and then collide with other bodies, repeating the process, gaining energy, and making the sim explode, or at least jitter endlessly. (Collisions between many close-by bodies also present other contact quality problems - bodies might "miss" each other and only contact some of the other shapes.)
The speculative contact system described is one approach towards resolving these kinds of instability problems: Basically, it uses velocity information to "look ahead" at where the body will move, and then it adjusts the velocity vector to fit so that the two bodies touch exactly. This can be repeated for all potential collisions, until the minimum movement for each body is found, at which point contacts may be generated.
I happened to discover exactly this technique independently, trying to make a simple game collision system as robust as possible even at high velocities. Velocity appears to be a critical piece of information for robustness, as all the heuristics I tried to separate bodies already interpenetrating led to major glitches when the heuristic guessed wrong. I also tried a very similar method of "rolling back time" by moving the body backwards along its existing velocity with a step-by-step approximation, until the collision no longer happened; this turned out to not be as good as modifying the future velocity vector to touch exactly, as it was cruder, left points of contact inexact, and thrashed the original velocity values, leading to things stopping dead and "sticking" as soon as they collided anything at all.
- pufuwozu 16y agoThat helped a lot. Thank you!