From 2b1374c596957ac8cabe085859be3b823a1ba0c6 Mon Sep 17 00:00:00 2001 From: Sébastien Crozet Date: Tue, 19 Apr 2022 18:57:40 +0200 Subject: First round deleting the component sets. --- src/dynamics/ccd/ccd_solver.rs | 70 ++++++++++-------------------------------- 1 file changed, 16 insertions(+), 54 deletions(-) (limited to 'src/dynamics/ccd') diff --git a/src/dynamics/ccd/ccd_solver.rs b/src/dynamics/ccd/ccd_solver.rs index bd3b20b..8fc5a7f 100644 --- a/src/dynamics/ccd/ccd_solver.rs +++ b/src/dynamics/ccd/ccd_solver.rs @@ -1,11 +1,11 @@ use super::TOIEntry; -use crate::data::{BundleSet, ComponentSet, ComponentSetMut, ComponentSetOption}; -use crate::dynamics::{IslandManager, RigidBodyColliders, RigidBodyForces}; use crate::dynamics::{ - RigidBodyCcd, RigidBodyHandle, RigidBodyMassProps, RigidBodyPosition, RigidBodyVelocity, + IslandManager, RigidBodyCcd, RigidBodyColliders, RigidBodyForces, RigidBodyHandle, + RigidBodyMassProps, RigidBodyPosition, RigidBodySet, RigidBodyVelocity, }; use crate::geometry::{ - ColliderParent, ColliderPosition, ColliderShape, ColliderType, CollisionEvent, NarrowPhase, + ColliderParent, ColliderPosition, ColliderSet, ColliderShape, ColliderType, CollisionEvent, + NarrowPhase, }; use crate::math::Real; use crate::parry::utils::SortedPair; @@ -57,13 +57,7 @@ impl CCDSolver { /// Apply motion-clamping to the bodies affected by the given `impacts`. /// /// The `impacts` should be the result of a previous call to `self.predict_next_impacts`. - pub fn clamp_motions(&self, dt: Real, bodies: &mut Bodies, impacts: &PredictedImpacts) - where - Bodies: ComponentSet - + ComponentSetMut - + ComponentSet - + ComponentSet, - { + pub fn clamp_motions(&self, dt: Real, bodies: &mut RigidBodySet, impacts: &PredictedImpacts) { match impacts { PredictedImpacts::Impacts(tois) => { for (handle, toi) in tois { @@ -93,18 +87,13 @@ impl CCDSolver { /// Updates the set of bodies that needs CCD to be resolved. /// /// Returns `true` if any rigid-body must have CCD resolved. - pub fn update_ccd_active_flags( + pub fn update_ccd_active_flags( &self, islands: &IslandManager, - bodies: &mut Bodies, + bodies: &mut RigidBodySet, dt: Real, include_forces: bool, - ) -> bool - where - Bodies: ComponentSetMut - + ComponentSet - + ComponentSet, - { + ) -> bool { let mut ccd_active = false; // println!("Checking CCD activation"); @@ -128,27 +117,14 @@ impl CCDSolver { } /// Find the first time a CCD-enabled body has a non-sensor collider hitting another non-sensor collider. - pub fn find_first_impact( + pub fn find_first_impact( &mut self, dt: Real, islands: &IslandManager, - bodies: &Bodies, - colliders: &Colliders, + bodies: &RigidBodySet, + colliders: &ColliderSet, narrow_phase: &NarrowPhase, - ) -> Option - where - Bodies: ComponentSet - + ComponentSet - + ComponentSet - + ComponentSet - + ComponentSet - + ComponentSet, - Colliders: ComponentSetOption - + ComponentSet - + ComponentSet - + ComponentSet - + ComponentSet, - { + ) -> Option { // Update the query pipeline. self.query_pipeline.update_with_mode( islands, @@ -266,29 +242,15 @@ impl CCDSolver { } /// Outputs the set of bodies as well as their first time-of-impact event. - pub fn predict_impacts_at_next_positions( + pub fn predict_impacts_at_next_positions( &mut self, dt: Real, islands: &IslandManager, - bodies: &Bodies, - colliders: &Colliders, + bodies: &RigidBodySet, + colliders: &ColliderSet, narrow_phase: &NarrowPhase, events: &dyn EventHandler, - ) -> PredictedImpacts - where - Bodies: ComponentSet - + ComponentSet - + ComponentSet - + ComponentSet - + ComponentSet - + ComponentSet, - Colliders: ComponentSetOption - + ComponentSet - + ComponentSet - + ComponentSet - + ComponentSet - + ComponentSet, - { + ) -> PredictedImpacts { let mut frozen = HashMap::<_, Real>::default(); let mut all_toi = BinaryHeap::new(); let mut pairs_seen = HashMap::default(); -- cgit