Collision detection inconsistency

Hey guys,



I’ve been playing with collision detection, specifically the HelloPhysics tutorial.

Loading the example with default values for initial cannon ball velocity seems to be working great.

However, doubling the initial velocity from 25 to 50 and above seems to make the ball slip through other objects sometimes.



Is there a fix or a way to improve this? Is that by any chance caused by a slip in calculations during update cycles?

It is probably tunneling. That is for one tick of the physics calculation the object moves so far that it “jumps through” the obstacle. In frame A it is on front and frame B it is behind and Bullet physics simply will not see the collision. You can play with CCD-threshold, it tries to compensate for this by using a sweep test.



Here’s an example of the problem with a custom mesh.

Note that it still works as intended 50% of the time so it’s no a complete screw up.

The balls are actually stuck in the wall and are still spinning. Sometimes they go completely through.

yup, have a look at TestCcd.java in the jMETests/bullet.



Also your triangles are too big as well, which will cause buggy physics

Thanks, that seems to have improved things significantly. Is there a practical limit to CCD motion threshold?