Color visualization for grounded character controller (#705)

This commit is contained in:
Thierry Berger
2024-08-02 11:49:45 +02:00
committed by GitHub
parent 595b952c52
commit 364b5b7c37
3 changed files with 17 additions and 0 deletions

View File

@@ -845,6 +845,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(
graphics.materials,
character_handle,
[0.1, 0.8, 0.1],
);
} else {
graphics.graphics.set_body_color(
graphics.materials,
character_handle,
[0.8, 0.1, 0.1],
);
}
}
controller.solve_character_collision_impulses(
phx.integration_parameters.dt,
&mut phx.bodies,