Collisions dont work sometimes

Sometimes the ball (rigidbody) going throught platform (rigidbody) on high speed. The platform is moving with apply impulse function. Im also using box2D physics instead (same thing happening with the default, but i think its happening more often)
Thank you for your attention!

i think i figured it out. it stops going through collision after enabling continuous_cd

if you can give me some suggestions i will be very thankful!

continous_cd sounds good for this object. Other options are making the paddle’s collision much larger. You could increase the physics tick rate, but the problem will only occur less, and it has a potentially high performance impact.

1 Like

An inherent limitation to using static collision shapes is that they cannot handle fast moving objects. When two (or more) objects are moving quickly, they can easily skip over the others’ locations instead of colliding.

Using continuous collision detection can help to a certain degree, but it has a significant performance cost, since you’re doing all of your potential collisions more often, while suffering from the same limitations as above.

The best solution I’ve come across is the use of swept collision volumes, but Godot doesn’t support them directly. You can construct them from Godot’s collision primitives, though. The basic idea goes something like this:

For each potential collision pair, you remember where the objects were on the prior frame and calculate where they are in the current frame. You then construct collision volumes for both objects that encompass their entire movement space and see if those volumes overlap.

This technique allows infinite movement speed while requiring only a little more runtime overhead than static collision shapes, but is significantly more work than using static collision shapes.

1 Like