* 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
30 lines
1005 B
Rust
30 lines
1005 B
Rust
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());
|
|
}
|