chore: update to the latest parry api
This commit is contained in:
committed by
Sébastien Crozet
parent
dbefeb0418
commit
7565e5e4ef
@@ -341,7 +341,7 @@ impl DynamicRayCastVehicleController {
|
|||||||
wheel.raycast_info.ground_object = None;
|
wheel.raycast_info.ground_object = None;
|
||||||
|
|
||||||
if let Some((collider_hit, mut hit)) = hit {
|
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 collider = &colliders[collider_hit];
|
||||||
let up_ray = Ray::new(source + rayvector, -rayvector);
|
let up_ray = Ray::new(source + rayvector, -rayvector);
|
||||||
if let Some(hit2) =
|
if let Some(hit2) =
|
||||||
@@ -362,7 +362,7 @@ impl DynamicRayCastVehicleController {
|
|||||||
wheel.raycast_info.is_in_contact = true;
|
wheel.raycast_info.is_in_contact = true;
|
||||||
wheel.raycast_info.ground_object = Some(collider_hit);
|
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;
|
wheel.raycast_info.suspension_length = hit_distance - wheel.radius;
|
||||||
|
|
||||||
// clamp on max suspension travel
|
// clamp on max suspension travel
|
||||||
@@ -372,7 +372,7 @@ impl DynamicRayCastVehicleController {
|
|||||||
.raycast_info
|
.raycast_info
|
||||||
.suspension_length
|
.suspension_length
|
||||||
.clamp(min_suspension_length, max_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
|
let denominator = wheel
|
||||||
.raycast_info
|
.raycast_info
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ impl TOIEntry {
|
|||||||
// .ok();
|
// .ok();
|
||||||
|
|
||||||
let res_toi = query_dispatcher
|
let res_toi = query_dispatcher
|
||||||
.nonlinear_time_of_impact(
|
.cast_shapes_nonlinear(
|
||||||
&motion_c1,
|
&motion_c1,
|
||||||
co1.shape.as_ref(),
|
co1.shape.as_ref(),
|
||||||
&motion_c2,
|
&motion_c2,
|
||||||
@@ -143,7 +143,7 @@ impl TOIEntry {
|
|||||||
let toi = res_toi??;
|
let toi = res_toi??;
|
||||||
|
|
||||||
Some(Self::new(
|
Some(Self::new(
|
||||||
toi.toi,
|
toi.time_of_impact,
|
||||||
ch1,
|
ch1,
|
||||||
co1.parent.map(|p| p.handle),
|
co1.parent.map(|p| p.handle),
|
||||||
ch2,
|
ch2,
|
||||||
|
|||||||
@@ -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
|
/// 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
|
/// 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.
|
/// 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.
|
/// Updates the broad-phase.
|
||||||
///
|
///
|
||||||
/// The results must be output through the `events` struct. The broad-phase algorithm is only
|
/// The results must be output through the `events` struct. The broad-phase algorithm is only
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ pub type Ray = parry::query::Ray;
|
|||||||
pub type RayIntersection = parry::query::RayIntersection;
|
pub type RayIntersection = parry::query::RayIntersection;
|
||||||
/// The projection of a point on a collider.
|
/// The projection of a point on a collider.
|
||||||
pub type PointProjection = parry::query::PointProjection;
|
pub type PointProjection = parry::query::PointProjection;
|
||||||
/// The time of impact between two shapes.
|
/// The result of a shape-cast between two shapes.
|
||||||
pub type TOI = parry::query::TOI;
|
pub type ShapeCastHit = parry::query::ShapeCastHit;
|
||||||
/// The default broad-phase implementation recommended for general-purpose usage.
|
/// The default broad-phase implementation recommended for general-purpose usage.
|
||||||
pub type DefaultBroadPhase = BroadPhaseMultiSap;
|
pub type DefaultBroadPhase = BroadPhaseMultiSap;
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ use parry::query::details::{
|
|||||||
NonlinearTOICompositeShapeShapeBestFirstVisitor, NormalConstraints,
|
NonlinearTOICompositeShapeShapeBestFirstVisitor, NormalConstraints,
|
||||||
PointCompositeShapeProjBestFirstVisitor, PointCompositeShapeProjWithFeatureBestFirstVisitor,
|
PointCompositeShapeProjBestFirstVisitor, PointCompositeShapeProjWithFeatureBestFirstVisitor,
|
||||||
RayCompositeShapeToiAndNormalBestFirstVisitor, RayCompositeShapeToiBestFirstVisitor,
|
RayCompositeShapeToiAndNormalBestFirstVisitor, RayCompositeShapeToiBestFirstVisitor,
|
||||||
TOICompositeShapeShapeBestFirstVisitor,
|
ShapeCastOptions, TOICompositeShapeShapeBestFirstVisitor,
|
||||||
};
|
};
|
||||||
use parry::query::visitors::{
|
use parry::query::visitors::{
|
||||||
BoundingVolumeIntersectionsVisitor, PointIntersectionsVisitor, RayIntersectionsVisitor,
|
BoundingVolumeIntersectionsVisitor, PointIntersectionsVisitor, RayIntersectionsVisitor,
|
||||||
};
|
};
|
||||||
use parry::query::{DefaultQueryDispatcher, NonlinearRigidMotion, QueryDispatcher, TOI};
|
use parry::query::{DefaultQueryDispatcher, NonlinearRigidMotion, QueryDispatcher, ShapeCastHit};
|
||||||
use parry::shape::{FeatureId, Shape, TypedSimdCompositeShape};
|
use parry::shape::{FeatureId, Shape, TypedSimdCompositeShape};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
@@ -679,10 +679,9 @@ impl QueryPipeline {
|
|||||||
shape_pos: &Isometry<Real>,
|
shape_pos: &Isometry<Real>,
|
||||||
shape_vel: &Vector<Real>,
|
shape_vel: &Vector<Real>,
|
||||||
shape: &dyn Shape,
|
shape: &dyn Shape,
|
||||||
max_toi: Real,
|
options: ShapeCastOptions,
|
||||||
stop_at_penetration: bool,
|
|
||||||
filter: QueryFilter,
|
filter: QueryFilter,
|
||||||
) -> Option<(ColliderHandle, TOI)> {
|
) -> Option<(ColliderHandle, ShapeCastHit)> {
|
||||||
let pipeline_shape = self.as_composite_shape(bodies, colliders, filter);
|
let pipeline_shape = self.as_composite_shape(bodies, colliders, filter);
|
||||||
let mut visitor = TOICompositeShapeShapeBestFirstVisitor::new(
|
let mut visitor = TOICompositeShapeShapeBestFirstVisitor::new(
|
||||||
&*self.query_dispatcher,
|
&*self.query_dispatcher,
|
||||||
@@ -690,8 +689,7 @@ impl QueryPipeline {
|
|||||||
shape_vel,
|
shape_vel,
|
||||||
&pipeline_shape,
|
&pipeline_shape,
|
||||||
shape,
|
shape,
|
||||||
max_toi,
|
options,
|
||||||
stop_at_penetration,
|
|
||||||
);
|
);
|
||||||
self.qbvh.traverse_best_first(&mut visitor).map(|h| h.1)
|
self.qbvh.traverse_best_first(&mut visitor).map(|h| h.1)
|
||||||
}
|
}
|
||||||
@@ -725,7 +723,7 @@ impl QueryPipeline {
|
|||||||
end_time: Real,
|
end_time: Real,
|
||||||
stop_at_penetration: bool,
|
stop_at_penetration: bool,
|
||||||
filter: QueryFilter,
|
filter: QueryFilter,
|
||||||
) -> Option<(ColliderHandle, TOI)> {
|
) -> Option<(ColliderHandle, ShapeCastHit)> {
|
||||||
let pipeline_shape = self.as_composite_shape(bodies, colliders, filter);
|
let pipeline_shape = self.as_composite_shape(bodies, colliders, filter);
|
||||||
let pipeline_motion = NonlinearRigidMotion::identity();
|
let pipeline_motion = NonlinearRigidMotion::identity();
|
||||||
let mut visitor = NonlinearTOICompositeShapeShapeBestFirstVisitor::new(
|
let mut visitor = NonlinearTOICompositeShapeShapeBestFirstVisitor::new(
|
||||||
|
|||||||
Reference in New Issue
Block a user