Skip to content

Commit

Permalink
allow users to specify custom BroadPhase impl
Browse files Browse the repository at this point in the history
  • Loading branch information
rlidwka committed Oct 11, 2024
1 parent f17bd5b commit 8d8d4ef
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/plugin/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use std::collections::HashMap;
use std::sync::RwLock;

use rapier::prelude::{
CCDSolver, ColliderHandle, ColliderSet, EventHandler, FeatureId, ImpulseJointHandle,
ImpulseJointSet, IntegrationParameters, IslandManager, MultibodyJointHandle, MultibodyJointSet,
NarrowPhase, PhysicsHooks, PhysicsPipeline, QueryFilter as RapierQueryFilter, QueryPipeline,
Ray, Real, RigidBodyHandle, RigidBodySet,
BroadPhase, CCDSolver, ColliderHandle, ColliderSet, EventHandler, FeatureId,
ImpulseJointHandle, ImpulseJointSet, IntegrationParameters, IslandManager,
MultibodyJointHandle, MultibodyJointSet, NarrowPhase, PhysicsHooks, PhysicsPipeline,
QueryFilter as RapierQueryFilter, QueryPipeline, Ray, Real, RigidBodyHandle, RigidBodySet,
};

use crate::geometry::{Collider, PointProjection, RayIntersection, ShapeCastHit};
Expand All @@ -33,7 +33,7 @@ pub struct RapierContext {
/// (not moving much) to reduce computations.
pub islands: IslandManager,
/// The broad-phase, which detects potential contact pairs.
pub broad_phase: DefaultBroadPhase,
pub broad_phase: Box<dyn BroadPhase>,
/// The narrow-phase, which computes contact points, tests intersections,
/// and maintain the contact and intersection graphs.
pub narrow_phase: NarrowPhase,
Expand Down Expand Up @@ -80,7 +80,7 @@ impl Default for RapierContext {
fn default() -> Self {
Self {
islands: IslandManager::new(),
broad_phase: DefaultBroadPhase::new(),
broad_phase: Box::new(DefaultBroadPhase::new()),
narrow_phase: NarrowPhase::new(),
bodies: RigidBodySet::new(),
colliders: ColliderSet::new(),
Expand Down Expand Up @@ -260,7 +260,7 @@ impl RapierContext {
&gravity.into(),
&substep_integration_parameters,
&mut self.islands,
&mut self.broad_phase,
&mut *self.broad_phase,
&mut self.narrow_phase,
&mut self.bodies,
&mut self.colliders,
Expand Down Expand Up @@ -291,7 +291,7 @@ impl RapierContext {
&gravity.into(),
&substep_integration_parameters,
&mut self.islands,
&mut self.broad_phase,
&mut *self.broad_phase,
&mut self.narrow_phase,
&mut self.bodies,
&mut self.colliders,
Expand All @@ -315,7 +315,7 @@ impl RapierContext {
&gravity.into(),
&substep_integration_parameters,
&mut self.islands,
&mut self.broad_phase,
&mut *self.broad_phase,
&mut self.narrow_phase,
&mut self.bodies,
&mut self.colliders,
Expand Down

0 comments on commit 8d8d4ef

Please sign in to comment.