bevy_rapier
bevy_rapier copied to clipboard
A potential bug in CCD
I have hit a strange bug, I am not sure if it is caused by my code or rapier
I have simple Pong
game and if the ball passes the red lines, a new round would start which means the current ball will get despawned and a new ball will be spawned.
The bug is that when the ball is with high velocity, it will hit the paddle and trigger the intersection event(as if it is passing the red line) and thus triggered the new round and a new ball is spawned.
So basically every time the ball hit the paddle, it first triggers a Contact Event and because the ball is fast, it some how magically, virtually passes the red line. I am not sure if it is tunneling or a well-known issue in physics engine
I have uploaded a minimum repo and here is the setup for the ball https://github.com/chungwong/rapier_maybe_bug/blob/main/src/ball.rs#L23
Reduce the speed at this line will not trigger the problem https://github.com/chungwong/rapier_maybe_bug/blob/main/src/ball.rs#L86 And increase the offset of the paddles(moving them further) will kind of aovid the bug too. https://github.com/chungwong/rapier_maybe_bug/blob/main/src/collider.rs#L83
A screenshot