chore: update to the latest parry api

This commit is contained in:
Sébastien Crozet
2024-05-04 17:51:15 +02:00
committed by Sébastien Crozet
parent dbefeb0418
commit 7565e5e4ef
5 changed files with 14 additions and 16 deletions

View File

@@ -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

View File

@@ -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,

View File

@@ -12,7 +12,7 @@ pub type BroadPhaseProxyIndex = u32;
/// two objects dont 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

View File

@@ -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;

View File

@@ -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(