1
votes

I am trying to implement a sphere sphere collision. I understand the math behind it. However, I am still looking around tutorials to see if there are better and faster approaches. I came across nehe's collision detection tutorial ( http://nehe.gamedev.net/tutorial/collision_detection/17005/ ). In this tutorial, if I understood correctly, he is trying to check if two spheres collides within a frame, and he tries not to miss it, by first checking if their paths intersect. And then tries to simulate it in a way.

My approach was to check every frame, whether spheres are colliding and be done with it. I didnt consider checking intersection paths etc. Now I am kinda confused how to approach to the problem.

My question is, is it really necessary trying to be that safe and check if we missed the collision by one frame ?

1
it is if the spheres go further than their own diameter in a single frame - ratchet freak
Like, if they move too fast and maybe one gets inside the other sphere because we are too late to evaluate ? - Ozum Safa
It is a matter of accuracy. Do you want to detect collisions in just the current frame or also between this frame and the next ? A collision occurs when the distance between centers becomes smaller than the sum of radii. If you know the motion equations (position as a function of time, usually uniform movement), you'll get an equation in one unknown (quadratic ?). - Yves Daoust
Yeah, now that I think about it, if we dont check that, spheres could go crazy and completely intersect - Ozum Safa
They can indeed intersect between frames but nobody will SEE it happen, they can just guess it. - Yves Daoust

1 Answers

0
votes

When writing collision detection algorithms, it is important to recognize objects are moving at discrete time steps, unlike the real world. In a typical modern game, objects will be moving with a time step of 0.016 seconds per frame (often with smaller fixed or variable time steps).

It is possible that two spheres moving with very high velocities could pass through each other during a single frame and not be within each other's bounding spheres after integration is performed. This problem is called Tunneling and there are multiple ways, each with varying levels of complexity and cost, to approach the problem. Some options are swept volumes and Minkowski Addition.

Choosing the right algorithm depends on your application. How precise does the collision need to be? Is it vital to your application or can you get away with some false negatives/positives. Typically, the more precise the collision detection, the more you pay in performance.

Similar question here