dimforge / dimforge/bevy_rapier

A potential bug in CCD

Open
#129 0 comments 0 reactions 0 assignees View on GitHub
A-Dynamics A-Integration C-Bug D-Medium P-High S-not-started
Dominant language
Rust
Stars
1.6k
Forks
282
PR merge metrics
No merged PRs in 30d

Description

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
![Screenshot from 2022-03-30 19-28-25](https://user-images.githubusercontent.com/1691249/160794497-e481bab8-291b-41a9-8c5a-d236b90fcc8c.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.