thread 'main' panicked at 'No element at index', /home/david/.cargo/registry/src/github.com-1ecc6299db9ec823/rapier3d-0.7.1/src/geometry/collider_set.rs:142:17
It seems to be caused by the recent change that tracks modifications to colliders:
// src/main.rs
use rapier3d::pipeline::*;
use rapier3d::dynamics::*;
use rapier3d::geometry::*;
use rapier3d::na::*;
fn main() {
let mut pipeline = PhysicsPipeline::new();
let gravity = Vector3::new(0.0, -9.81, 0.0);
let integration_parameters = IntegrationParameters::default();
let mut broad_phase = BroadPhase::new();
let mut narrow_phase = NarrowPhase::new();
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let mut ccd = CCDSolver::new();
let mut joints = JointSet::new();
let physics_hooks = ();
let event_handler = ();
let body = RigidBodyBuilder::new_dynamic().translation(0.0, 1.01, 0.0).build();
let b_handle = bodies.insert(body);
let collider = ColliderBuilder::ball(1.0).build();
let c_handle = colliders.insert(collider, b_handle, &mut bodies);
colliders.remove(c_handle, &mut bodies, true);
bodies.remove(b_handle, &mut colliders, &mut joints); // Happens with and without this line
loop {
pipeline.step(
&gravity,
&integration_parameters,
&mut broad_phase,
&mut narrow_phase,
&mut bodies,
&mut colliders,
&mut joints,
&mut ccd,
&physics_hooks,
&event_handler,
);
}
}
Removing a collider and stepping causes a panic:
It seems to be caused by the recent change that tracks modifications to colliders:
https://github.com/dimforge/rapier/blob/7557d2a6ee20488835998c8aef4541ed5ada576f/src/geometry/collider_set.rs#L133-L145
Reproduction project: