feat: update to parry 0.21
This commit is contained in:
committed by
Sébastien Crozet
parent
b798e1942d
commit
ef47848fba
@@ -738,7 +738,6 @@ impl RigidBodyVelocity {
|
||||
impl std::ops::Mul<Real> for RigidBodyVelocity {
|
||||
type Output = Self;
|
||||
|
||||
#[must_use]
|
||||
fn mul(self, rhs: Real) -> Self {
|
||||
RigidBodyVelocity {
|
||||
linvel: self.linvel * rhs,
|
||||
@@ -750,7 +749,6 @@ impl std::ops::Mul<Real> for RigidBodyVelocity {
|
||||
impl std::ops::Add<RigidBodyVelocity> for RigidBodyVelocity {
|
||||
type Output = Self;
|
||||
|
||||
#[must_use]
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
RigidBodyVelocity {
|
||||
linvel: self.linvel + rhs.linvel,
|
||||
@@ -769,7 +767,6 @@ impl std::ops::AddAssign<RigidBodyVelocity> for RigidBodyVelocity {
|
||||
impl std::ops::Sub<RigidBodyVelocity> for RigidBodyVelocity {
|
||||
type Output = Self;
|
||||
|
||||
#[must_use]
|
||||
fn sub(self, rhs: Self) -> Self {
|
||||
RigidBodyVelocity {
|
||||
linvel: self.linvel - rhs.linvel,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use crate::geometry::{BroadPhasePairEvent, ColliderHandle, ColliderPair, ColliderSet};
|
||||
use crate::dynamics::RigidBodySet;
|
||||
use crate::geometry::{BroadPhase, BroadPhasePairEvent, ColliderHandle, ColliderPair, ColliderSet};
|
||||
use parry::math::Real;
|
||||
use parry::partitioning::Qbvh;
|
||||
use parry::partitioning::QbvhUpdateWorkspace;
|
||||
@@ -27,12 +28,15 @@ impl BroadPhaseQbvh {
|
||||
workspace: QbvhUpdateWorkspace::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)] // This broad-phase is just experimental right now.
|
||||
pub fn update(
|
||||
impl BroadPhase for BroadPhaseQbvh {
|
||||
fn update(
|
||||
&mut self,
|
||||
dt: Real,
|
||||
prediction_distance: Real,
|
||||
colliders: &ColliderSet,
|
||||
colliders: &mut ColliderSet,
|
||||
bodies: &RigidBodySet,
|
||||
modified_colliders: &[ColliderHandle],
|
||||
removed_colliders: &[ColliderHandle],
|
||||
events: &mut Vec<BroadPhasePairEvent>,
|
||||
@@ -46,7 +50,9 @@ impl BroadPhaseQbvh {
|
||||
// Visitor to find collision pairs.
|
||||
let mut visitor = BoundingVolumeIntersectionsSimultaneousVisitor::new(
|
||||
|co1: &ColliderHandle, co2: &ColliderHandle| {
|
||||
events.push(BroadPhasePairEvent::AddPair(ColliderPair::new(*co1, *co2)));
|
||||
if *co1 != *co2 {
|
||||
events.push(BroadPhasePairEvent::AddPair(ColliderPair::new(*co1, *co2)));
|
||||
}
|
||||
true
|
||||
},
|
||||
);
|
||||
@@ -77,6 +83,8 @@ impl BroadPhaseQbvh {
|
||||
let _ = self.qbvh.refit(margin, &mut self.workspace, |handle| {
|
||||
colliders[*handle].compute_collision_aabb(prediction_distance / 2.0)
|
||||
});
|
||||
// self.qbvh
|
||||
// .traverse_bvtt_with_stack(&self.qbvh, &mut visitor, &mut self.stack);
|
||||
self.qbvh
|
||||
.traverse_modified_bvtt_with_stack(&self.qbvh, &mut visitor, &mut self.stack);
|
||||
self.qbvh.rebalance(margin, &mut self.workspace);
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::pipeline::{ActiveEvents, ActiveHooks};
|
||||
use crate::prelude::ColliderEnabled;
|
||||
use na::Unit;
|
||||
use parry::bounding_volume::{Aabb, BoundingVolume};
|
||||
use parry::shape::{Shape, TriMeshBuilderError, TriMeshFlags, VoxelPrimitiveGeometry};
|
||||
use parry::shape::{Shape, TriMeshBuilderError, TriMeshFlags};
|
||||
use parry::transformation::voxelization::FillMode;
|
||||
|
||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||
@@ -580,45 +580,28 @@ impl ColliderBuilder {
|
||||
///
|
||||
/// For initializing a voxels shape from points in space, see [`Self::voxels_from_points`].
|
||||
/// For initializing a voxels shape from a mesh to voxelize, see [`Self::voxelized_mesh`].
|
||||
pub fn voxels(
|
||||
primitive_geometry: VoxelPrimitiveGeometry,
|
||||
voxel_size: Vector<Real>,
|
||||
voxels: &[Point<i32>],
|
||||
) -> Self {
|
||||
Self::new(SharedShape::voxels(primitive_geometry, voxel_size, voxels))
|
||||
pub fn voxels(voxel_size: Vector<Real>, voxels: &[Point<i32>]) -> Self {
|
||||
Self::new(SharedShape::voxels(voxel_size, voxels))
|
||||
}
|
||||
|
||||
/// Initializes a collider made of voxels.
|
||||
///
|
||||
/// Each voxel has the size `voxel_size` and contains at least one point from `centers`.
|
||||
/// The `primitive_geometry` controls the behavior of collision detection at voxels boundaries.
|
||||
pub fn voxels_from_points(
|
||||
primitive_geometry: VoxelPrimitiveGeometry,
|
||||
voxel_size: Vector<Real>,
|
||||
points: &[Point<Real>],
|
||||
) -> Self {
|
||||
Self::new(SharedShape::voxels_from_points(
|
||||
primitive_geometry,
|
||||
voxel_size,
|
||||
points,
|
||||
))
|
||||
pub fn voxels_from_points(voxel_size: Vector<Real>, points: &[Point<Real>]) -> Self {
|
||||
Self::new(SharedShape::voxels_from_points(voxel_size, points))
|
||||
}
|
||||
|
||||
/// Initializes a voxels obtained from the decomposition of the given trimesh (in 3D)
|
||||
/// or polyline (in 2D) into voxelized convex parts.
|
||||
pub fn voxelized_mesh(
|
||||
primitive_geometry: VoxelPrimitiveGeometry,
|
||||
vertices: &[Point<Real>],
|
||||
indices: &[[u32; DIM]],
|
||||
voxel_size: Real,
|
||||
fill_mode: FillMode,
|
||||
) -> Self {
|
||||
Self::new(SharedShape::voxelized_mesh(
|
||||
primitive_geometry,
|
||||
vertices,
|
||||
indices,
|
||||
voxel_size,
|
||||
fill_mode,
|
||||
vertices, indices, voxel_size, fill_mode,
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ pub use self::narrow_phase::NarrowPhase;
|
||||
|
||||
pub use parry::bounding_volume::BoundingVolume;
|
||||
pub use parry::query::{PointQuery, PointQueryWithLocation, RayCast, TrackedContact};
|
||||
pub use parry::shape::{SharedShape, VoxelPrimitiveGeometry, VoxelState, VoxelType, Voxels};
|
||||
pub use parry::shape::{SharedShape, VoxelState, VoxelType, Voxels};
|
||||
|
||||
use crate::math::{Real, Vector};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user