feat: switch to the new Bvh from parry for the broad-phase (#853)

* feat: switch to the new Bvh from parry for the broad-phase

* chore: cargo fmt + update testbed

* chore: remove the multi-grid SAP broad-phase

* fix soft-ccd handling in broad-phase

* Fix contact cleanup in broad-phase after collider removal

* chore: clippy fixes

* fix CCD regression

* chore: update changelog

* fix build with the parallel feature enabled

* chore: remove the now useless broad-phase proxy index from colliders

* fix tests
This commit is contained in:
Sébastien Crozet
2025-07-11 22:36:40 +02:00
committed by GitHub
parent 86a257d4f1
commit 95bd6fcfeb
212 changed files with 2140 additions and 3953 deletions

View File

@@ -1,11 +1,11 @@
use rapier_testbed3d::{
KeyCode, PhysicsState, TestbedGraphics,
ui::egui::{Align2, ComboBox, Slider, Ui, Window},
};
use rapier3d::{
control::{CharacterLength, KinematicCharacterController, PidController},
prelude::*,
};
use rapier_testbed3d::{
ui::egui::{Align2, ComboBox, Slider, Ui, Window},
KeyCode, PhysicsState, TestbedGraphics,
};
pub type CharacterSpeed = Real;
@@ -143,18 +143,27 @@ fn update_kinematic_controller(
let character_body = &phx.bodies[character_handle];
let character_collider = &phx.colliders[character_body.colliders()[0]];
let character_pose = *character_collider.position();
let character_shape = character_collider.shared_shape().clone();
let character_mass = character_body.mass();
let Some(broad_phase) = phx.broad_phase.downcast_ref::<BroadPhaseBvh>() else {
return;
};
let query_pipeline = broad_phase.as_query_pipeline_mut(
phx.narrow_phase.query_dispatcher(),
&mut phx.bodies,
&mut phx.colliders,
QueryFilter::new().exclude_rigid_body(character_handle),
);
let mut collisions = vec![];
let mvt = controller.move_shape(
phx.integration_parameters.dt,
&phx.bodies,
&phx.colliders,
&phx.query_pipeline,
character_collider.shape(),
character_collider.position(),
&query_pipeline.as_ref(),
&*character_shape,
&character_pose,
desired_movement.cast::<Real>(),
QueryFilter::new().exclude_rigid_body(character_handle),
|c| collisions.push(c),
);
@@ -166,13 +175,10 @@ fn update_kinematic_controller(
controller.solve_character_collision_impulses(
phx.integration_parameters.dt,
&mut phx.bodies,
&phx.colliders,
&phx.query_pipeline,
character_collider.shape(),
query_pipeline,
&*character_shape,
character_mass,
&*collisions,
QueryFilter::new().exclude_rigid_body(character_handle),
);
let character_body = &mut phx.bodies[character_handle];