Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples2d/character_controller2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub fn init_world(testbed: &mut Testbed) {
let character_handle = bodies.insert(rigid_body);
let collider = ColliderBuilder::capsule_y(0.3, 0.15);
colliders.insert_with_parent(collider, character_handle, &mut bodies);
testbed.set_initial_body_color(character_handle, [0.8, 0.1, 0.1]);

/*
* Create the cubes
Expand Down
1 change: 1 addition & 0 deletions examples3d/character_controller3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub fn init_world(testbed: &mut Testbed) {
let character_handle = bodies.insert(rigid_body);
let collider = ColliderBuilder::capsule_y(0.3 * scale, 0.15 * scale); // 0.15, 0.3, 0.15);
colliders.insert_with_parent(collider, character_handle, &mut bodies);
testbed.set_initial_body_color(character_handle, [0.8, 0.1, 0.1]);

/*
* Create the cubes
Expand Down
16 changes: 16 additions & 0 deletions src_testbed/testbed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ impl TestbedApp {
.add_systems(Update, track_mouse_state);

init(&mut app);

Comment thread
ThierryBerger marked this conversation as resolved.
Outdated
app.run();
}
}
Expand Down Expand Up @@ -803,6 +804,21 @@ impl<'a, 'b, 'c, 'd, 'e, 'f> Testbed<'a, 'b, 'c, 'd, 'e, 'f> {
QueryFilter::new().exclude_rigid_body(character_handle),
|c| collisions.push(c),
);
if let Some(graphics) = &mut self.graphics {
if mvt.grounded {
graphics.graphics.set_body_color(
&mut graphics.materials,
Comment thread
ThierryBerger marked this conversation as resolved.
Outdated
character_handle,
[0.1, 0.8, 0.1],
);
} else {
graphics.graphics.set_body_color(
&mut graphics.materials,
Comment thread
ThierryBerger marked this conversation as resolved.
Outdated
character_handle,
[0.8, 0.1, 0.1],
);
}
}
controller.solve_character_collision_impulses(
phx.integration_parameters.dt,
&mut phx.bodies,
Expand Down