Skip to content

Commit 8d8d4ef

Browse files
committed
allow users to specify custom BroadPhase impl
1 parent f17bd5b commit 8d8d4ef

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/plugin/context.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ use std::collections::HashMap;
33
use std::sync::RwLock;
44

55
use rapier::prelude::{
6-
CCDSolver, ColliderHandle, ColliderSet, EventHandler, FeatureId, ImpulseJointHandle,
7-
ImpulseJointSet, IntegrationParameters, IslandManager, MultibodyJointHandle, MultibodyJointSet,
8-
NarrowPhase, PhysicsHooks, PhysicsPipeline, QueryFilter as RapierQueryFilter, QueryPipeline,
9-
Ray, Real, RigidBodyHandle, RigidBodySet,
6+
BroadPhase, CCDSolver, ColliderHandle, ColliderSet, EventHandler, FeatureId,
7+
ImpulseJointHandle, ImpulseJointSet, IntegrationParameters, IslandManager,
8+
MultibodyJointHandle, MultibodyJointSet, NarrowPhase, PhysicsHooks, PhysicsPipeline,
9+
QueryFilter as RapierQueryFilter, QueryPipeline, Ray, Real, RigidBodyHandle, RigidBodySet,
1010
};
1111

1212
use crate::geometry::{Collider, PointProjection, RayIntersection, ShapeCastHit};
@@ -33,7 +33,7 @@ pub struct RapierContext {
3333
/// (not moving much) to reduce computations.
3434
pub islands: IslandManager,
3535
/// The broad-phase, which detects potential contact pairs.
36-
pub broad_phase: DefaultBroadPhase,
36+
pub broad_phase: Box<dyn BroadPhase>,
3737
/// The narrow-phase, which computes contact points, tests intersections,
3838
/// and maintain the contact and intersection graphs.
3939
pub narrow_phase: NarrowPhase,
@@ -80,7 +80,7 @@ impl Default for RapierContext {
8080
fn default() -> Self {
8181
Self {
8282
islands: IslandManager::new(),
83-
broad_phase: DefaultBroadPhase::new(),
83+
broad_phase: Box::new(DefaultBroadPhase::new()),
8484
narrow_phase: NarrowPhase::new(),
8585
bodies: RigidBodySet::new(),
8686
colliders: ColliderSet::new(),
@@ -260,7 +260,7 @@ impl RapierContext {
260260
&gravity.into(),
261261
&substep_integration_parameters,
262262
&mut self.islands,
263-
&mut self.broad_phase,
263+
&mut *self.broad_phase,
264264
&mut self.narrow_phase,
265265
&mut self.bodies,
266266
&mut self.colliders,
@@ -291,7 +291,7 @@ impl RapierContext {
291291
&gravity.into(),
292292
&substep_integration_parameters,
293293
&mut self.islands,
294-
&mut self.broad_phase,
294+
&mut *self.broad_phase,
295295
&mut self.narrow_phase,
296296
&mut self.bodies,
297297
&mut self.colliders,
@@ -315,7 +315,7 @@ impl RapierContext {
315315
&gravity.into(),
316316
&substep_integration_parameters,
317317
&mut self.islands,
318-
&mut self.broad_phase,
318+
&mut *self.broad_phase,
319319
&mut self.narrow_phase,
320320
&mut self.bodies,
321321
&mut self.colliders,

0 commit comments

Comments
 (0)