Fix user-change handling for colliders as well as disabled colliders (#900)

* feat: add debug-demo for disabling a collider

* feat: add a simple debug-demo with two cubes

* feat: rename RigidBodyChangnes::MODIFIED and ColliderChanges::MODIFIED to ::IN_MODIFIED_SET

* feat: render debug-colliders with a different color with the debug-renderer

* chore: wire up new examples to the testbed

* fix colliders user-modification being ignored after the first step

* fix broad-phase still taking into account disabled colliders with enabled dynamic rigid-bodies

* chore: update changelog

* fix cargo doc
This commit is contained in:
Sébastien Crozet
2025-11-14 09:35:02 +01:00
committed by GitHub
parent a68d0c600b
commit ef5dcaccaf
11 changed files with 146 additions and 26 deletions

View File

@@ -0,0 +1,29 @@
use rapier_testbed3d::Testbed;
use rapier3d::prelude::*;
pub fn init_world(testbed: &mut Testbed) {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let impulse_joints = ImpulseJointSet::new();
let multibody_joints = MultibodyJointSet::new();
// Dynamic box rigid body.
let rigid_body = RigidBodyBuilder::dynamic().translation(vector![0.0, 2.0, 0.0]);
let handle = bodies.insert(rigid_body);
let collider = ColliderBuilder::cuboid(0.5, 0.5, 0.5);
colliders.insert_with_parent(collider, handle, &mut bodies);
let rigid_body = RigidBodyBuilder::fixed();
let handle = bodies.insert(rigid_body);
let collider = ColliderBuilder::cuboid(0.5, 0.5, 0.5);
colliders.insert_with_parent(collider, handle, &mut bodies);
/*
* Set up the testbed.
*/
testbed.set_world(bodies, colliders, impulse_joints, multibody_joints);
testbed.look_at(point![10.0, 10.0, 10.0], Point::origin());
}