diff options
| author | Sébastien Crozet <sebcrozet@dimforge.com> | 2024-05-04 17:51:15 +0200 |
|---|---|---|
| committer | Sébastien Crozet <sebastien@crozet.re> | 2024-05-05 16:17:39 +0200 |
| commit | 7565e5e4efb56bb8ba987c251b932bffc15a40c8 (patch) | |
| tree | 037acb54bcb7384811214f966bb5e5680ac17d5c | |
| parent | dbefeb04186226536ec7f4f248c71f056265916a (diff) | |
| download | rapier-7565e5e4efb56bb8ba987c251b932bffc15a40c8.tar.gz rapier-7565e5e4efb56bb8ba987c251b932bffc15a40c8.tar.bz2 rapier-7565e5e4efb56bb8ba987c251b932bffc15a40c8.zip | |
chore: update to the latest parry api
| -rw-r--r-- | src/control/ray_cast_vehicle_controller.rs | 6 | ||||
| -rw-r--r-- | src/dynamics/ccd/toi_entry.rs | 4 | ||||
| -rw-r--r-- | src/geometry/broad_phase.rs | 2 | ||||
| -rw-r--r-- | src/geometry/mod.rs | 4 | ||||
| -rw-r--r-- | src/pipeline/query_pipeline.rs | 14 |
5 files changed, 14 insertions, 16 deletions
diff --git a/src/control/ray_cast_vehicle_controller.rs b/src/control/ray_cast_vehicle_controller.rs index 00b11eb..98b6339 100644 --- a/src/control/ray_cast_vehicle_controller.rs +++ b/src/control/ray_cast_vehicle_controller.rs @@ -341,7 +341,7 @@ impl DynamicRayCastVehicleController { wheel.raycast_info.ground_object = None; if let Some((collider_hit, mut hit)) = hit { - if hit.toi == 0.0 { + if hit.time_of_impact == 0.0 { let collider = &colliders[collider_hit]; let up_ray = Ray::new(source + rayvector, -rayvector); if let Some(hit2) = @@ -362,7 +362,7 @@ impl DynamicRayCastVehicleController { wheel.raycast_info.is_in_contact = true; wheel.raycast_info.ground_object = Some(collider_hit); - let hit_distance = hit.toi * raylen; + let hit_distance = hit.time_of_impact * raylen; wheel.raycast_info.suspension_length = hit_distance - wheel.radius; // clamp on max suspension travel @@ -372,7 +372,7 @@ impl DynamicRayCastVehicleController { .raycast_info .suspension_length .clamp(min_suspension_length, max_suspension_length); - wheel.raycast_info.contact_point_ws = ray.point_at(hit.toi); + wheel.raycast_info.contact_point_ws = ray.point_at(hit.time_of_impact); let denominator = wheel .raycast_info diff --git a/src/dynamics/ccd/toi_entry.rs b/src/dynamics/ccd/toi_entry.rs index 719f3c5..426cbb1 100644 --- a/src/dynamics/ccd/toi_entry.rs +++ b/src/dynamics/ccd/toi_entry.rs @@ -129,7 +129,7 @@ impl TOIEntry { // .ok(); let res_toi = query_dispatcher - .nonlinear_time_of_impact( + .cast_shapes_nonlinear( &motion_c1, co1.shape.as_ref(), &motion_c2, @@ -143,7 +143,7 @@ impl TOIEntry { let toi = res_toi??; Some(Self::new( - toi.toi, + toi.time_of_impact, ch1, co1.parent.map(|p| p.handle), ch2, diff --git a/src/geometry/broad_phase.rs b/src/geometry/broad_phase.rs index 836ebc8..06164a1 100644 --- a/src/geometry/broad_phase.rs +++ b/src/geometry/broad_phase.rs @@ -12,7 +12,7 @@ pub type BroadPhaseProxyIndex = u32; /// two objects don’t actually touch, but it is incorrect to remove a pair between two objects /// that are still touching. In other words, it can have false-positive (though these induce /// some computational overhead on the narrow-phase), but cannot have false-negative. -pub trait BroadPhase { +pub trait BroadPhase: Send + Sync + 'static { /// Updates the broad-phase. /// /// The results must be output through the `events` struct. The broad-phase algorithm is only diff --git a/src/geometry/mod.rs b/src/geometry/mod.rs index be2d9d5..1eaad79 100644 --- a/src/geometry/mod.rs +++ b/src/geometry/mod.rs @@ -51,8 +51,8 @@ pub type Ray = parry::query::Ray; pub type RayIntersection = parry::query::RayIntersection; /// The projection of a point on a collider. pub type PointProjection = parry::query::PointProjection; -/// The time of impact between two shapes. -pub type TOI = parry::query::TOI; +/// The result of a shape-cast between two shapes. +pub type ShapeCastHit = parry::query::ShapeCastHit; /// The default broad-phase implementation recommended for general-purpose usage. pub type DefaultBroadPhase = BroadPhaseMultiSap; diff --git a/src/pipeline/query_pipeline.rs b/src/pipeline/query_pipeline.rs index d98017b..f202107 100644 --- a/src/pipeline/query_pipeline.rs +++ b/src/pipeline/query_pipeline.rs @@ -9,12 +9,12 @@ use parry::query::details::{ NonlinearTOICompositeShapeShapeBestFirstVisitor, NormalConstraints, PointCompositeShapeProjBestFirstVisitor, PointCompositeShapeProjWithFeatureBestFirstVisitor, RayCompositeShapeToiAndNormalBestFirstVisitor, RayCompositeShapeToiBestFirstVisitor, - TOICompositeShapeShapeBestFirstVisitor, + ShapeCastOptions, TOICompositeShapeShapeBestFirstVisitor, }; use parry::query::visitors::{ BoundingVolumeIntersectionsVisitor, PointIntersectionsVisitor, RayIntersectionsVisitor, }; -use parry::query::{DefaultQueryDispatcher, NonlinearRigidMotion, QueryDispatcher, TOI}; +use parry::query::{DefaultQueryDispatcher, NonlinearRigidMotion, QueryDispatcher, ShapeCastHit}; use parry::shape::{FeatureId, Shape, TypedSimdCompositeShape}; use std::sync::Arc; @@ -679,10 +679,9 @@ impl QueryPipeline { shape_pos: &Isometry<Real>, shape_vel: &Vector<Real>, shape: &dyn Shape, - max_toi: Real, - stop_at_penetration: bool, + options: ShapeCastOptions, filter: QueryFilter, - ) -> Option<(ColliderHandle, TOI)> { + ) -> Option<(ColliderHandle, ShapeCastHit)> { let pipeline_shape = self.as_composite_shape(bodies, colliders, filter); let mut visitor = TOICompositeShapeShapeBestFirstVisitor::new( &*self.query_dispatcher, @@ -690,8 +689,7 @@ impl QueryPipeline { shape_vel, &pipeline_shape, shape, - max_toi, - stop_at_penetration, + options, ); self.qbvh.traverse_best_first(&mut visitor).map(|h| h.1) } @@ -725,7 +723,7 @@ impl QueryPipeline { end_time: Real, stop_at_penetration: bool, filter: QueryFilter, - ) -> Option<(ColliderHandle, TOI)> { + ) -> Option<(ColliderHandle, ShapeCastHit)> { let pipeline_shape = self.as_composite_shape(bodies, colliders, filter); let pipeline_motion = NonlinearRigidMotion::identity(); let mut visitor = NonlinearTOICompositeShapeShapeBestFirstVisitor::new( |
