🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Help Finding Continuous Collision Detection Resources

Started by
2 comments, last by Dirk Gregorius 5 years, 3 months ago

Hello, I am looking for some help in finding some concrete resources on continuous collision detection, my preferred medium is published books but web pages are perfectly fine too. I am not too fond of academic papers as their real world application are sometimes a bit lacking, however publications from game studios are great and I would definitely appreciate those.

It appears to me that there is not actually much out there in terms of implementing CCD in a custom physics engine. I do not want to use an existing physics engine as I really enjoy the process of learning how everything is working behind the scenes. I have read/viewed the most obvious sources that I've come across from Googling and haven't quite gotten the information that I am looking for. Some of the sources I've used already are:

- Game Physics Engine Development by Ian Millington: This book while a fantastic resource on implementing a physics engine, completely ignores continuous collision detection and only acknowledges discrete collision detection.

- Real-Time Collision Detection by Christer Ericson: This only seems to glance over the topic in the section 2.4.3, it mentions swept volumes and indeed gives some hints on how to use swept volumes by providing further information on capsule collisions in 4.5 but it leaves quite a lot to the imagination on where to go from there.

- Physics for Game Programmers; Continuous Collision talk by Erin Catto at GDC 2013: Erin approaches the problem from a different perspective with his continuous advancement algorithm however I cant exactly make out how to integrate this solution into my physics engine.

- Various game engine/physics engine documentation & source code: They all seem to use either swept volumes or speculative contacts/continuous advancement or give the option of both so clearly these are the solutions to be using.

- Various Stackoverlfow / Gamedev.net posts but these all seem to loop back to the previous sources.

 

My need for CCD like others is to prevent tunneling on high velocity objects (bullets are my most prevalent case with velocity >500m/s). I would like to be able to have CCD work against other collders with CCD enabled, even though this will be a very costly process I still would like to have the option there for completeness.

 

My current collision detection setup works as follows:

1) Any game object with a collider component that has moved this frame is added to an update set with the physics engine.

2) Each collider in this update is tested against the scene octree to get a list of potential collisions.

3) These potential collision are investigated with the GJK algorithm and have their contact points calculated if necessary.

 

What I think could work:

1) Maintain a separate list at all times of colliders with CCD enabled.

2) If a collider with CCD enables is contained in the update set, then test its swept volume against the octree to get potential collisions.

3) Sort these potential collision by their distance along the swept volumes movement vector and choose the smallest distance as the collision.

4) Simply brute force (O(n^2)) against all other colliders with CCD enabled, as there wont be too many colliders with this special CCD property turned on I think brute force is an acceptable sacrifice.

5) Respond to this detected collision. (not entirely sure on how to do this response, how can I get the time of impact?)

 

I should mention that everything takes place in 3D and AABBs are the bounding volumes that I use on my colliders for broad phase collision detection.

Sorry for the wall of text and I look forward to hearing any answers or suggestions that anyone can provide.

Thanks

Advertisement
17 minutes ago, Ronan085 said:

- Various game engine/physics engine documentation & source code: They all seem to use either swept volumes or speculative contacts/continuous advancement or give the option of both so clearly these are the solutions to be using.

Ok may be you can look into bullet physics source code, since i am using bullet for my game and i have faced the same tunneling problem .But it is handling it very well now with CCD. now i can shoot balls of 1m radius with 1000m/s without tunneling. May be it will give you a hint.

 

note: I really don't know about anything in terms of CCD  implementation or any physics rather than basics. 

I usually distinguish between continuous collision detection (CCD) and continuous physics (CP). CCD is about computing the first time of impact (TOI) between two moving objects. A common approach for this is called conservative advancement (CA) which was initially introduced in the PhD by Brian Mirtich (s. link below). Erin Catto introduced an improvement which addresses some problems of classic CA in the talk you mentioned above. The integration into a physic engine is what I call CP. Many different approaches exist for this. E.g. some people use an additional inner sphere collider which prevents object falling out of the world. Another popular approach is called speculative contacts (s. links below). The most comprehensive approach which goes along with your description is actually found in Box2D. This is the most generic CP that is publicly available which can handle fast static vs dynamic and dynamic vs dynamic collisions. I recommend having a look there (s. link below). This is your best learning resource!

I agree with your observation. A lot of the common knowledge of both CCD and CP is proprietary. This is not surprising since these are among the hardest problems I know. The common approach is not to implement some general solution, but  something specific to your game. E.g. do you maybe only need some simple tunneling prevention. Hopefully the resources below will provide useful.

 

Brian Mirtich PhD:

https://people.eecs.berkeley.edu/~jfc/mirtich/thesis/mirtichThesis.pdf

 

Speculative contacts:

https://wildbunny.co.uk/blog/2011/03/25/speculative-contacts-an-continuous-collision-engine-approach-part-1/

http://twvideo01.ubm-us.net/o1/vault/gdc2012/slides/Programming Track/Vincent_ROBERT_Track_ADifferentApproach.pdf

 

Box2D continuous physics starts here:

https://github.com/erincatto/Box2D/blob/master/Box2D/Dynamics/b2World.cpp#L943

This topic is closed to new replies.

Advertisement