Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic RigidBody getting stuck in corners #487

Open
jhgarner opened this issue Mar 24, 2024 · 2 comments
Open

Dynamic RigidBody getting stuck in corners #487

jhgarner opened this issue Mar 24, 2024 · 2 comments
Labels
A-Dynamics A-Geometry D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... P-High arbitrary important item

Comments

@jhgarner
Copy link

jhgarner commented Mar 24, 2024

I have a setup with a single dynamic RigidBody on top of a floor and inside of 4 walls all of which have no friction. The dynamic RigidBody is moved by directly adjusting its velocity. I expect the RigidBody to slide around the room between the walls smoothly, but instead it appears to get hung up in corners. I've created a small example showcasing the problem: https://github.com/jhgarner/bevy-physics-repro/tree/main. The example code is in src/main.rs. You can use cargo run -- broken and the arrow keys to move the cube around and see the strange behavior. You can also run the repo with cargo run -- working which will create a slightly smaller RigidBody which doesn't get stuck and moves smoothly. I can't figure out why the slightly larger one exhibits the issue while the smaller one doesn't.

Here's a recording from running the example with cargo run -- broken:
broken.webm

And here's a recording from running the example with carg run -- working:
working.webm

Is there a different setup I should be using for something like this?

@Vrixyz Vrixyz added D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... P-High arbitrary important item A-Geometry A-Dynamics labels May 21, 2024
@Vrixyz
Copy link
Contributor

Vrixyz commented May 21, 2024

I'm noting there has been a few versions released since the report, it would be interesting to know if this is still happening with an updated reproduction

@jhgarner
Copy link
Author

I'm still seeing the issue after updating to the latest versions (I've pushed the latest versions to the example repo).

I think the issue might come from Parry? Since creating this bug, I gave Xpbd a try and saw similar problems. I also tried experimenting with my own physics system + Parry .14's time of impact functions and saw weird behavior when the aabbs were touching or moving such that they'd end up touching. If I remember right, Parry would report no collision on really small velocities when the objects actually ended up touching. I ended up copying https://tavianator.com/2011/ray_box.html for toi calculations and constraining my game to simpler physics objects. There was a lot changing in my code then though so take this analysis with a grain of salt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Dynamics A-Geometry D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... P-High arbitrary important item
Projects
None yet
Development

No branches or pull requests

2 participants