Despawning MultiBodyJoint handling entities panic
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
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.
can be related to https://github.com/dimforge/rapier/issues/382
more recent duplicate https://github.com/dimforge/rapier/issues/382, gotta choose one to keep, closing this one 😅