bevy_rapier icon indicating copy to clipboard operation
bevy_rapier copied to clipboard

Despawning MultiBodyJoint handling entities panic

Open LIMachi opened this issue 3 years ago • 2 comments

Bevy 0.7, Bevy_Rapier 0.14.1

fn clear_mbjoints(mut commands: Commands, joints: Query<Entity, With<RapierMultibodyJointHandle>>) { for e in joints.iter() { commands.entity(e).despawn(); } }

the above code when used as a system, in a scene with entities that were spawned with a MultibodyJoint component, will result in a panic: thread 'main' panicked at 'called 'Option::unwrap()' on a 'None' value', C:\Users\hugom\.cargo\registry\src\github.com-1ecc6299db9ec823\rapier3d-0.13.0\src\dynamics\joint\multibody_joint\multibody_joint_set.rs:173:74

LIMachi avatar Jun 16 '22 11:06 LIMachi

same on bevy_rapier3d 0.18.0 thread 'main' panicked at 'called Option::unwrap()on aNone value', /Users/alexi/.cargo/registry/src/github.com-1ecc6299db9ec823/rapier3d-0.16.0/src/dynamics/joint/multibody_joint/multibody_joint_set.rs:173:29

I couldn't workaround this for a car here https://github.com/alexichepura/bevy-rapier-car-sim Multibody works way cooler for multiple cars, but despawn panics. Workaround is use of impulsejoints with more iterations.

alexichepura avatar Nov 04 '22 12:11 alexichepura

can be related to https://github.com/dimforge/rapier/issues/382

alexichepura avatar Nov 19 '22 10:11 alexichepura

more recent duplicate https://github.com/dimforge/rapier/issues/382, gotta choose one to keep, closing this one 😅

ThierryBerger avatar May 24 '24 10:05 ThierryBerger