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

Panic in narrow_phase after "pause" using rapier_config.physics_pipeline_active = false #179

Open
Elogain opened this issue May 29, 2022 · 2 comments
Labels
A-Integration very bevy specific C-Bug Something isn't working D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... P-Medium S-not-started Work has not started

Comments

@Elogain
Copy link

Elogain commented May 29, 2022

Hello!

Im getting a panic after resuming the RapierConfiguration physics_pipeline_active after having it set to false for a while. Basically, I pause the simulation as the player is presented with a level-up window. Once it is closed I resume the physics simulation (among other things). Every now and then (1 out of 100?) I get bitten by a panic on this line:

https://github.com/dimforge/bevy_rapier/blob/master/src/plugin/narrow_phase.rs#L307

My code causing the call to collider2() is basically:

for contact_pair in rapier_context.contacts_with(player_entity) {
        let other_collider = if contact_pair.collider1() == player_entity {
            contact_pair.collider2()
        } else {
            contact_pair.collider1()
        };
        ...
}

The code lives in a system that runs every frame.

It feels like it might be some weird condition in the frame where bevy state is changed from ingame -> levelup and the removal of an entity that would have been collider2() in that same frame. Perhaps it mucks up the state in contacts vs what the bevy-rapier "sync removals" method removes. It seems like just as it unpauses and the system that panics runs it'll look at stale collider data that still has a collision with an entity that was removed in that frame where the gamestate changed (simulation paused). Am using version 0.13.1.

@BenGale93
Copy link

Also getting this crash seemingly at random in 0.18.0. My code doesn't set physics_pipeline_active to false at any point, however. Sorry I can't be of any more help.

@BenGale93
Copy link

I have a bit more info to go on. My bevy app is a simulation, so I often leave it for some time. This crash often happens when I go back to my PC and wake the monitors up from standby. I have absolutely no idea why this might be the cause but it might help someone else.

@Vrixyz Vrixyz added C-Bug Something isn't working D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... P-Medium S-not-started Work has not started A-Integration very bevy specific labels May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Integration very bevy specific C-Bug Something isn't working D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... P-Medium S-not-started Work has not started
Projects
None yet
Development

No branches or pull requests

3 participants