Skip to content

Commit

Permalink
Update JoltC and bind new API
Browse files Browse the repository at this point in the history
  • Loading branch information
LPGhatguy committed Jan 8, 2025
1 parent 206f24a commit c65897b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/joltc-sys/JoltC
17 changes: 16 additions & 1 deletion crates/rolt/src/physics_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use joltc_sys::*;

use crate::{
BodyInterface, BroadPhaseLayerInterfaceImpl, NarrowPhaseQuery, ObjectLayerPairFilterImpl,
ObjectVsBroadPhaseLayerFilterImpl,
ObjectVsBroadPhaseLayerFilterImpl, SimShapeFilterImpl,
};

/// The root of everything for a physics simulation.
Expand All @@ -15,6 +15,7 @@ pub struct PhysicsSystem {
broad_phase_layer_interface: Option<BroadPhaseLayerInterfaceImpl<'static>>,
object_vs_broad_phase_layer_filter: Option<ObjectVsBroadPhaseLayerFilterImpl<'static>>,
object_layer_pair_filter: Option<ObjectLayerPairFilterImpl<'static>>,
sim_shape_filter: Option<SimShapeFilterImpl<'static>>,
}

impl PhysicsSystem {
Expand All @@ -25,6 +26,7 @@ impl PhysicsSystem {
broad_phase_layer_interface: None,
object_vs_broad_phase_layer_filter: None,
object_layer_pair_filter: None,
sim_shape_filter: None,
}
}
}
Expand Down Expand Up @@ -65,6 +67,19 @@ impl PhysicsSystem {
}
}

pub fn set_sim_shape_filter(
&mut self,
sim_shape_filter: impl Into<SimShapeFilterImpl<'static>>,
) {
let sim_shape_filter = sim_shape_filter.into();
let raw = sim_shape_filter.as_raw();
self.sim_shape_filter = Some(sim_shape_filter);

unsafe {
JPC_PhysicsSystem_SetSimShapeFilter(self.raw, raw);
}
}

pub fn optimize_broad_phase(&self) {
unsafe {
JPC_PhysicsSystem_OptimizeBroadPhase(self.raw);
Expand Down

0 comments on commit c65897b

Please sign in to comment.