feat: add the DefaultBroadPhase type alias
This commit is contained in:
committed by
Sébastien Crozet
parent
3d112287b9
commit
b3a00b4123
@@ -16,7 +16,8 @@
|
|||||||
### Modified
|
### Modified
|
||||||
|
|
||||||
- Renamed `BroadPhase` to `BroadPhaseMultiSap`. The `BroadPhase` is no a trait that can be
|
- Renamed `BroadPhase` to `BroadPhaseMultiSap`. The `BroadPhase` is no a trait that can be
|
||||||
implemented for providing a custom broad-phase to rapier.
|
implemented for providing a custom broad-phase to rapier. Equivalently, the `DefaultBroadPhase` type
|
||||||
|
alias can be used in place of `BroadPhaseMultiSap`.
|
||||||
|
|
||||||
## v0.18.0 (24 Jan. 2024)
|
## v0.18.0 (24 Jan. 2024)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use rapier_testbed3d::Testbed;
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
struct State {
|
struct State {
|
||||||
pub islands: IslandManager,
|
pub islands: IslandManager,
|
||||||
pub broad_phase: BroadPhaseMultiSap,
|
pub broad_phase: DefaultBroadPhase,
|
||||||
pub narrow_phase: NarrowPhase,
|
pub narrow_phase: NarrowPhase,
|
||||||
pub bodies: RigidBodySet,
|
pub bodies: RigidBodySet,
|
||||||
pub colliders: ColliderSet,
|
pub colliders: ColliderSet,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ struct PhysicsState {
|
|||||||
pub gravity: Vector<f32>,
|
pub gravity: Vector<f32>,
|
||||||
pub integration_parameters: IntegrationParameters,
|
pub integration_parameters: IntegrationParameters,
|
||||||
pub islands: IslandManager,
|
pub islands: IslandManager,
|
||||||
pub broad_phase: BroadPhaseMultiSap,
|
pub broad_phase: DefaultBroadPhase,
|
||||||
pub narrow_phase: NarrowPhase,
|
pub narrow_phase: NarrowPhase,
|
||||||
pub bodies: RigidBodySet,
|
pub bodies: RigidBodySet,
|
||||||
pub colliders: ColliderSet,
|
pub colliders: ColliderSet,
|
||||||
|
|||||||
@@ -49,10 +49,12 @@ pub type Aabb = parry::bounding_volume::Aabb;
|
|||||||
pub type Ray = parry::query::Ray;
|
pub type Ray = parry::query::Ray;
|
||||||
/// The intersection between a ray and a collider.
|
/// The intersection between a ray and a collider.
|
||||||
pub type RayIntersection = parry::query::RayIntersection;
|
pub type RayIntersection = parry::query::RayIntersection;
|
||||||
/// The 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 the time of impact between two shapes.
|
/// The time of impact between two shapes.
|
||||||
pub type TOI = parry::query::TOI;
|
pub type TOI = parry::query::TOI;
|
||||||
|
/// The default broad-phase implementation provided by Rapier.
|
||||||
|
pub type DefaultBroadPhase = BroadPhaseMultiSap;
|
||||||
|
|
||||||
bitflags::bitflags! {
|
bitflags::bitflags! {
|
||||||
/// Flags providing more information regarding a collision event.
|
/// Flags providing more information regarding a collision event.
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
use crate::dynamics::{ImpulseJointSet, MultibodyJointSet};
|
use crate::dynamics::{ImpulseJointSet, MultibodyJointSet};
|
||||||
use crate::geometry::{
|
use crate::geometry::{
|
||||||
BroadPhase, BroadPhaseMultiSap, BroadPhasePairEvent, ColliderChanges, ColliderHandle,
|
BroadPhase, BroadPhasePairEvent, ColliderChanges, ColliderHandle, ColliderPair, NarrowPhase,
|
||||||
ColliderPair, NarrowPhase,
|
|
||||||
};
|
};
|
||||||
use crate::math::Real;
|
use crate::math::Real;
|
||||||
use crate::pipeline::{EventHandler, PhysicsHooks, QueryPipeline};
|
use crate::pipeline::{EventHandler, PhysicsHooks, QueryPipeline};
|
||||||
@@ -108,7 +107,7 @@ impl CollisionPipeline {
|
|||||||
pub fn step(
|
pub fn step(
|
||||||
&mut self,
|
&mut self,
|
||||||
prediction_distance: Real,
|
prediction_distance: Real,
|
||||||
broad_phase: &mut BroadPhaseMultiSap,
|
broad_phase: &mut dyn BroadPhase,
|
||||||
narrow_phase: &mut NarrowPhase,
|
narrow_phase: &mut NarrowPhase,
|
||||||
bodies: &mut RigidBodySet,
|
bodies: &mut RigidBodySet,
|
||||||
colliders: &mut ColliderSet,
|
colliders: &mut ColliderSet,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use rapier::dynamics::{
|
|||||||
CCDSolver, ImpulseJointSet, IntegrationParameters, IslandManager, MultibodyJointSet,
|
CCDSolver, ImpulseJointSet, IntegrationParameters, IslandManager, MultibodyJointSet,
|
||||||
RigidBodySet,
|
RigidBodySet,
|
||||||
};
|
};
|
||||||
use rapier::geometry::{BroadPhaseMultiSap, ColliderSet, NarrowPhase};
|
use rapier::geometry::{ColliderSet, DefaultBroadPhase, NarrowPhase};
|
||||||
use rapier::math::{Real, Vector};
|
use rapier::math::{Real, Vector};
|
||||||
use rapier::pipeline::{ChannelEventCollector, PhysicsHooks, PhysicsPipeline, QueryPipeline};
|
use rapier::pipeline::{ChannelEventCollector, PhysicsHooks, PhysicsPipeline, QueryPipeline};
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ impl Harness {
|
|||||||
self.physics.hooks = Box::new(hooks);
|
self.physics.hooks = Box::new(hooks);
|
||||||
|
|
||||||
self.physics.islands = IslandManager::new();
|
self.physics.islands = IslandManager::new();
|
||||||
self.physics.broad_phase = BroadPhaseMultiSap::new();
|
self.physics.broad_phase = DefaultBroadPhase::new();
|
||||||
self.physics.narrow_phase = NarrowPhase::new();
|
self.physics.narrow_phase = NarrowPhase::new();
|
||||||
self.state.timestep_id = 0;
|
self.state.timestep_id = 0;
|
||||||
self.state.time = 0.0;
|
self.state.time = 0.0;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use rapier::dynamics::{
|
|||||||
RigidBodySet,
|
RigidBodySet,
|
||||||
};
|
};
|
||||||
use rapier::geometry::{
|
use rapier::geometry::{
|
||||||
BroadPhaseMultiSap, ColliderSet, CollisionEvent, ContactForceEvent, NarrowPhase,
|
ColliderSet, CollisionEvent, ContactForceEvent, DefaultBroadPhase, NarrowPhase,
|
||||||
};
|
};
|
||||||
use rapier::math::{Real, Vector};
|
use rapier::math::{Real, Vector};
|
||||||
use rapier::pipeline::{PhysicsHooks, PhysicsPipeline, QueryPipeline};
|
use rapier::pipeline::{PhysicsHooks, PhysicsPipeline, QueryPipeline};
|
||||||
@@ -22,7 +22,7 @@ pub struct PhysicsSnapshot {
|
|||||||
|
|
||||||
pub struct DeserializedPhysicsSnapshot {
|
pub struct DeserializedPhysicsSnapshot {
|
||||||
pub timestep_id: usize,
|
pub timestep_id: usize,
|
||||||
pub broad_phase: BroadPhaseMultiSap,
|
pub broad_phase: DefaultBroadPhase,
|
||||||
pub narrow_phase: NarrowPhase,
|
pub narrow_phase: NarrowPhase,
|
||||||
pub island_manager: IslandManager,
|
pub island_manager: IslandManager,
|
||||||
pub bodies: RigidBodySet,
|
pub bodies: RigidBodySet,
|
||||||
@@ -34,7 +34,7 @@ pub struct DeserializedPhysicsSnapshot {
|
|||||||
impl PhysicsSnapshot {
|
impl PhysicsSnapshot {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
timestep_id: usize,
|
timestep_id: usize,
|
||||||
broad_phase: &BroadPhaseMultiSap,
|
broad_phase: &DefaultBroadPhase,
|
||||||
narrow_phase: &NarrowPhase,
|
narrow_phase: &NarrowPhase,
|
||||||
island_manager: &IslandManager,
|
island_manager: &IslandManager,
|
||||||
bodies: &RigidBodySet,
|
bodies: &RigidBodySet,
|
||||||
@@ -88,7 +88,7 @@ impl PhysicsSnapshot {
|
|||||||
|
|
||||||
pub struct PhysicsState {
|
pub struct PhysicsState {
|
||||||
pub islands: IslandManager,
|
pub islands: IslandManager,
|
||||||
pub broad_phase: BroadPhaseMultiSap,
|
pub broad_phase: DefaultBroadPhase,
|
||||||
pub narrow_phase: NarrowPhase,
|
pub narrow_phase: NarrowPhase,
|
||||||
pub bodies: RigidBodySet,
|
pub bodies: RigidBodySet,
|
||||||
pub colliders: ColliderSet,
|
pub colliders: ColliderSet,
|
||||||
@@ -112,7 +112,7 @@ impl PhysicsState {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
islands: IslandManager::new(),
|
islands: IslandManager::new(),
|
||||||
broad_phase: BroadPhaseMultiSap::new(),
|
broad_phase: DefaultBroadPhase::new(),
|
||||||
narrow_phase: NarrowPhase::new(),
|
narrow_phase: NarrowPhase::new(),
|
||||||
bodies: RigidBodySet::new(),
|
bodies: RigidBodySet::new(),
|
||||||
colliders: ColliderSet::new(),
|
colliders: ColliderSet::new(),
|
||||||
|
|||||||
Reference in New Issue
Block a user