Page 1 of 1

CCD Problem

Posted: Fri Jun 30, 2017 1:37 pm
by moebius
I read a lot about CCD in the last few hours, but still I can't figure out a way to prevent my game's items from falling through the walls or floors in my game.

From what I understand the CcdMotionThreshold is the delta movement which the rigid body needs to exceed in one simulation step, before CCD kicks in, right? And the CcdSweptSphereRadius is the radius of the sphere that is then used to check for possible collisions all along the movement vector of the object.

What I don't understand is: does the swept sphere have to be bigger than the actual object so it contains all of the object or does it need to be smaller than the actual object so that the CCD algorithm does not miss an interception with another object?

I also figured that if I set the CCD threshold to the size of the shortest dimension of the bounding box surrounding my object, then the CCD should (in theory) always kick in when it is actually possible for the object to tunnel through another object, right? My game is moddable, so the items in the game can have various sizes, so I need a formula to calculate the right values for CcdMotionThreshold and CcdSweptSphere.

Also, despite of my best affords I was unable to prevent some items from falling through the floor and walls. Even if I set the CCD threshold to a very small number (e.g. 1e-7), the objects sometimes fall through.

Re: CCD Problem

Posted: Thu Jul 06, 2017 5:04 pm
by drleviathan
I've used CCD. I set the proxy sphere to be smaller than the bounding box of the object: the diameter was about 3/4 of the average of the two smallest sides of the bounding box, or something like that.

The per-object CCD speed threshold was set to the diameter of the CCD proxy sphere divided by the fixed substep time.

Even with these settings sometimes objects could tunnel through others: in particular long thin objects tumbling on a btBvhTriangleMeshShape floor. For best results only use convex shapes for your floors.