pub struct DestructionRuntime { /* private fields */ }Implementations§
Source§impl DestructionRuntime
impl DestructionRuntime
Sourcepub fn new(
destructible: DestructibleSet,
options: DestructionRuntimeOptions,
) -> Self
pub fn new( destructible: DestructibleSet, options: DestructionRuntimeOptions, ) -> Self
Creates a runtime around an existing low-level DestructibleSet.
Sourcepub fn from_scenario(
scenario: &ScenarioDesc,
settings: SolverSettings,
gravity: Vec3,
fracture_policy: FracturePolicy,
options: DestructionRuntimeOptions,
) -> Option<Self>
pub fn from_scenario( scenario: &ScenarioDesc, settings: SolverSettings, gravity: Vec3, fracture_policy: FracturePolicy, options: DestructionRuntimeOptions, ) -> Option<Self>
Builds a high-level runtime directly from a scenario description.
pub fn options(&self) -> DestructionRuntimeOptions
pub fn set_options(&mut self, options: DestructionRuntimeOptions)
pub fn into_inner(self) -> DestructibleSet
pub fn initialize( &mut self, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, ) -> Vec<RigidBodyHandle>
pub fn set_ground_body_handle(&mut self, handle: Option<RigidBodyHandle>)
pub fn refresh_collision_groups( &mut self, bodies: &RigidBodySet, colliders: &mut ColliderSet, )
pub fn set_sleep_thresholds(&mut self, options: SleepThresholdOptions)
pub fn set_small_body_damping(&mut self, options: SmallBodyDampingOptions)
pub fn set_debris_cleanup(&mut self, options: DebrisCleanupOptions)
pub fn set_debris_collision_mode(&mut self, mode: DebrisCollisionMode)
pub fn set_resimulation_options(&mut self, options: ResimulationOptions)
pub fn set_dynamic_body_ccd_enabled(&mut self, enabled: bool)
pub fn set_split_child_recentering_enabled(&mut self, enabled: bool)
pub fn set_split_child_velocity_fit_enabled(&mut self, enabled: bool)
pub fn set_skip_single_bodies(&mut self, enabled: bool)
Sourcepub fn begin_frame(&mut self, now_secs: f32, dt: f32, bodies: &RigidBodySet)
pub fn begin_frame(&mut self, now_secs: f32, dt: f32, bodies: &RigidBodySet)
Begins an advanced multi-pass frame.
Most consumers should prefer Self::step_frame, which wraps the full
destruction-aware Rapier loop for a frame.
pub fn begin_pass<'a, H, E>( &mut self, user_hooks: &'a H, user_events: &'a E, ) -> PassAdapter<'a, H, E>
Sourcepub fn finish_pass<H, E>(
&mut self,
pass: PassAdapter<'_, H, E>,
world: &mut RapierWorldAccess<'_>,
) -> FrameDirective
pub fn finish_pass<H, E>( &mut self, pass: PassAdapter<'_, H, E>, world: &mut RapierWorldAccess<'_>, ) -> FrameDirective
Completes one speculative Rapier pass started by Self::begin_frame.
Sourcepub fn step_frame<H, E, S>(
&mut self,
now_secs: f32,
dt: f32,
world: &mut RapierWorldAccess<'_>,
user_hooks: &H,
user_events: &E,
step: S,
) -> FrameResultwhere
H: PhysicsHooks + Sync + ?Sized,
E: EventHandler + ?Sized,
S: FnMut(&PassAdapter<'_, H, E>, &mut RapierWorldAccess<'_>),
pub fn step_frame<H, E, S>(
&mut self,
now_secs: f32,
dt: f32,
world: &mut RapierWorldAccess<'_>,
user_hooks: &H,
user_events: &E,
step: S,
) -> FrameResultwhere
H: PhysicsHooks + Sync + ?Sized,
E: EventHandler + ?Sized,
S: FnMut(&PassAdapter<'_, H, E>, &mut RapierWorldAccess<'_>),
Recommended high-level integration for existing Rapier apps.
The consumer still owns PhysicsPipeline::step(...). This helper wraps
the destruction-specific orchestration around that step: it buffers
speculative events, analyzes Rapier contacts, injects accepted impacts,
applies fractures and split edits, and resimulates the frame when body
topology changes.
Methods from Deref<Target = DestructibleSet>§
Sourcepub fn initialize(
&mut self,
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
) -> Vec<RigidBodyHandle>
pub fn initialize( &mut self, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, ) -> Vec<RigidBodyHandle>
Set up initial Rapier bodies from the solver’s actor table.
Must be called once before the first step().
Sourcepub fn step(
&mut self,
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
island_manager: &mut IslandManager,
impulse_joints: &mut ImpulseJointSet,
multibody_joints: &mut MultibodyJointSet,
) -> StepResult
pub fn step( &mut self, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, island_manager: &mut IslandManager, impulse_joints: &mut ImpulseJointSet, multibody_joints: &mut MultibodyJointSet, ) -> StepResult
Run one simulation step:
- Apply gravity
- Update stress solver
- Generate and apply fractures (rate-limited by policy)
- Create/destroy Rapier bodies for split events
- Apply excess forces to newly separated actors
pub fn step_with_time( &mut self, now_secs: f32, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, island_manager: &mut IslandManager, impulse_joints: &mut ImpulseJointSet, multibody_joints: &mut MultibodyJointSet, ) -> StepResult
Sourcepub fn add_force(&mut self, node_index: u32, position: Vec3, force: Vec3)
pub fn add_force(&mut self, node_index: u32, position: Vec3, force: Vec3)
Apply an external force to a node (e.g., from a projectile impact).
Sourcepub fn add_acceleration(
&mut self,
node_index: u32,
position: Vec3,
acceleration: Vec3,
)
pub fn add_acceleration( &mut self, node_index: u32, position: Vec3, acceleration: Vec3, )
Apply an external acceleration to a node.
Sourcepub fn node_body(&self, node_index: u32) -> Option<RigidBodyHandle>
pub fn node_body(&self, node_index: u32) -> Option<RigidBodyHandle>
Get the Rapier body handle for a node.
Sourcepub fn node_collider(&self, node_index: u32) -> Option<ColliderHandle>
pub fn node_collider(&self, node_index: u32) -> Option<ColliderHandle>
Get the Rapier collider handle for a node.
Sourcepub fn collider_node(&self, collider: ColliderHandle) -> Option<u32>
pub fn collider_node(&self, collider: ColliderHandle) -> Option<u32>
Get the node index owning a collider.
Sourcepub fn node_local_offset(&self, node_index: u32) -> Option<Vec3>
pub fn node_local_offset(&self, node_index: u32) -> Option<Vec3>
Get the node’s local offset relative to its owning Rapier body.
Sourcepub fn body_nodes(&self, body_handle: RigidBodyHandle) -> Vec<u32>
pub fn body_nodes(&self, body_handle: RigidBodyHandle) -> Vec<u32>
Get the node indices attached to a Rapier body.
pub fn body_nodes_slice(&self, body_handle: RigidBodyHandle) -> &[u32]
pub fn body_node_count(&self, body_handle: RigidBodyHandle) -> usize
pub fn body_has_support(&self, body_handle: RigidBodyHandle) -> bool
Sourcepub fn is_support(&self, node_index: u32) -> bool
pub fn is_support(&self, node_index: u32) -> bool
Whether a node is a fixed support.
Sourcepub fn actor_count(&self) -> u32
pub fn actor_count(&self) -> u32
Current actor count in the stress graph.
Sourcepub fn active_bond_count(&self) -> usize
pub fn active_bond_count(&self) -> usize
Number of bonds still considered active by the Rust-side fracture tracking.
Sourcepub fn body_count(&self) -> usize
pub fn body_count(&self) -> usize
Number of tracked Rapier bodies.
pub fn collider_count(&self) -> usize
pub fn dynamic_body_count(&self, bodies: &RigidBodySet) -> usize
pub fn awake_dynamic_body_count(&self, bodies: &RigidBodySet) -> usize
pub fn sleeping_dynamic_body_count(&self, bodies: &RigidBodySet) -> usize
pub fn support_body_count(&self) -> usize
pub fn ccd_enabled_body_count(&self, bodies: &RigidBodySet) -> usize
Sourcepub fn solver(&self) -> &ExtStressSolver
pub fn solver(&self) -> &ExtStressSolver
Access the underlying solver for advanced use.
Sourcepub fn solver_mut(&mut self) -> &mut ExtStressSolver
pub fn solver_mut(&mut self) -> &mut ExtStressSolver
Mutable access to the underlying solver.
Sourcepub fn policy(&self) -> &FracturePolicy
pub fn policy(&self) -> &FracturePolicy
Access the fracture policy.
Sourcepub fn set_policy(&mut self, policy: FracturePolicy)
pub fn set_policy(&mut self, policy: FracturePolicy)
Mutable access to the fracture policy.
pub fn resimulation_options(&self) -> ResimulationOptions
pub fn set_resimulation_options(&mut self, options: ResimulationOptions)
pub fn skip_single_bodies(&self) -> bool
pub fn set_skip_single_bodies(&mut self, enabled: bool)
pub fn sleep_thresholds(&self) -> SleepThresholdOptions
pub fn set_sleep_thresholds(&mut self, options: SleepThresholdOptions)
pub fn small_body_damping(&self) -> SmallBodyDampingOptions
pub fn set_small_body_damping(&mut self, options: SmallBodyDampingOptions)
pub fn debris_cleanup(&self) -> DebrisCleanupOptions
pub fn set_debris_cleanup(&mut self, options: DebrisCleanupOptions)
pub fn debris_collision_mode(&self) -> DebrisCollisionMode
pub fn set_debris_collision_mode(&mut self, mode: DebrisCollisionMode)
pub fn ground_body_handle(&self) -> Option<RigidBodyHandle>
pub fn set_ground_body_handle(&mut self, handle: Option<RigidBodyHandle>)
pub fn refresh_collision_groups( &self, bodies: &RigidBodySet, colliders: &mut ColliderSet, )
pub fn dynamic_body_ccd_enabled(&self) -> bool
pub fn set_dynamic_body_ccd_enabled(&mut self, enabled: bool)
pub fn set_split_child_recentering_enabled(&mut self, enabled: bool)
pub fn set_split_child_velocity_fit_enabled(&mut self, enabled: bool)
pub fn pending_split_event_count(&self) -> usize
pub fn pending_new_body_count(&self, bodies: &RigidBodySet) -> usize
pub fn pending_collider_migration_count(&self, bodies: &RigidBodySet) -> usize
pub fn needs_resimulation_snapshot(&self) -> bool
pub fn capture_resimulation_snapshot( &self, bodies: &RigidBodySet, ) -> BodySnapshots
pub fn mark_body_support_contact( &mut self, body_handle: RigidBodyHandle, now_secs: f32, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, ) -> bool
pub fn process_optimizations( &mut self, now_secs: f32, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, island_manager: &mut IslandManager, impulse_joints: &mut ImpulseJointSet, multibody_joints: &mut MultibodyJointSet, ) -> OptimizationResult
Trait Implementations§
Source§impl Deref for DestructionRuntime
impl Deref for DestructionRuntime
Auto Trait Implementations§
impl Freeze for DestructionRuntime
impl RefUnwindSafe for DestructionRuntime
impl Send for DestructionRuntime
impl Sync for DestructionRuntime
impl Unpin for DestructionRuntime
impl UnsafeUnpin for DestructionRuntime
impl UnwindSafe for DestructionRuntime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.