Skip to main content

DestructionRuntime

Struct DestructionRuntime 

Source
pub struct DestructionRuntime { /* private fields */ }

Implementations§

Source§

impl DestructionRuntime

Source

pub fn new( destructible: DestructibleSet, options: DestructionRuntimeOptions, ) -> Self

Creates a runtime around an existing low-level DestructibleSet.

Source

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.

Source

pub fn options(&self) -> DestructionRuntimeOptions

Source

pub fn set_options(&mut self, options: DestructionRuntimeOptions)

Source

pub fn into_inner(self) -> DestructibleSet

Source

pub fn initialize( &mut self, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, ) -> Vec<RigidBodyHandle>

Source

pub fn set_ground_body_handle(&mut self, handle: Option<RigidBodyHandle>)

Source

pub fn refresh_collision_groups( &mut self, bodies: &RigidBodySet, colliders: &mut ColliderSet, )

Source

pub fn set_sleep_thresholds(&mut self, options: SleepThresholdOptions)

Source

pub fn set_small_body_damping(&mut self, options: SmallBodyDampingOptions)

Source

pub fn set_debris_cleanup(&mut self, options: DebrisCleanupOptions)

Source

pub fn set_debris_collision_mode(&mut self, mode: DebrisCollisionMode)

Source

pub fn set_resimulation_options(&mut self, options: ResimulationOptions)

Source

pub fn set_dynamic_body_ccd_enabled(&mut self, enabled: bool)

Source

pub fn set_split_child_recentering_enabled(&mut self, enabled: bool)

Source

pub fn set_split_child_velocity_fit_enabled(&mut self, enabled: bool)

Source

pub fn set_skip_single_bodies(&mut self, enabled: bool)

Source

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.

Source

pub fn begin_pass<'a, H, E>( &mut self, user_hooks: &'a H, user_events: &'a E, ) -> PassAdapter<'a, H, E>
where H: PhysicsHooks + ?Sized, E: EventHandler + ?Sized,

Source

pub fn finish_pass<H, E>( &mut self, pass: PassAdapter<'_, H, E>, world: &mut RapierWorldAccess<'_>, ) -> FrameDirective
where H: PhysicsHooks + Sync + ?Sized, E: EventHandler + ?Sized,

Completes one speculative Rapier pass started by Self::begin_frame.

Source

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, ) -> FrameResult
where 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>§

Source

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().

Source

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:

  1. Apply gravity
  2. Update stress solver
  3. Generate and apply fractures (rate-limited by policy)
  4. Create/destroy Rapier bodies for split events
  5. Apply excess forces to newly separated actors
Source

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

Source

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).

Source

pub fn add_acceleration( &mut self, node_index: u32, position: Vec3, acceleration: Vec3, )

Apply an external acceleration to a node.

Source

pub fn node_body(&self, node_index: u32) -> Option<RigidBodyHandle>

Get the Rapier body handle for a node.

Source

pub fn node_collider(&self, node_index: u32) -> Option<ColliderHandle>

Get the Rapier collider handle for a node.

Source

pub fn collider_node(&self, collider: ColliderHandle) -> Option<u32>

Get the node index owning a collider.

Source

pub fn node_local_offset(&self, node_index: u32) -> Option<Vec3>

Get the node’s local offset relative to its owning Rapier body.

Source

pub fn body_nodes(&self, body_handle: RigidBodyHandle) -> Vec<u32>

Get the node indices attached to a Rapier body.

Source

pub fn body_nodes_slice(&self, body_handle: RigidBodyHandle) -> &[u32]

Source

pub fn body_node_count(&self, body_handle: RigidBodyHandle) -> usize

Source

pub fn body_has_support(&self, body_handle: RigidBodyHandle) -> bool

Source

pub fn is_support(&self, node_index: u32) -> bool

Whether a node is a fixed support.

Source

pub fn actor_count(&self) -> u32

Current actor count in the stress graph.

Source

pub fn active_bond_count(&self) -> usize

Number of bonds still considered active by the Rust-side fracture tracking.

Source

pub fn body_count(&self) -> usize

Number of tracked Rapier bodies.

Source

pub fn collider_count(&self) -> usize

Source

pub fn dynamic_body_count(&self, bodies: &RigidBodySet) -> usize

Source

pub fn awake_dynamic_body_count(&self, bodies: &RigidBodySet) -> usize

Source

pub fn sleeping_dynamic_body_count(&self, bodies: &RigidBodySet) -> usize

Source

pub fn support_body_count(&self) -> usize

Source

pub fn ccd_enabled_body_count(&self, bodies: &RigidBodySet) -> usize

Source

pub fn solver(&self) -> &ExtStressSolver

Access the underlying solver for advanced use.

Source

pub fn solver_mut(&mut self) -> &mut ExtStressSolver

Mutable access to the underlying solver.

Source

pub fn policy(&self) -> &FracturePolicy

Access the fracture policy.

Source

pub fn set_policy(&mut self, policy: FracturePolicy)

Mutable access to the fracture policy.

Source

pub fn resimulation_options(&self) -> ResimulationOptions

Source

pub fn set_resimulation_options(&mut self, options: ResimulationOptions)

Source

pub fn skip_single_bodies(&self) -> bool

Source

pub fn set_skip_single_bodies(&mut self, enabled: bool)

Source

pub fn sleep_thresholds(&self) -> SleepThresholdOptions

Source

pub fn set_sleep_thresholds(&mut self, options: SleepThresholdOptions)

Source

pub fn small_body_damping(&self) -> SmallBodyDampingOptions

Source

pub fn set_small_body_damping(&mut self, options: SmallBodyDampingOptions)

Source

pub fn debris_cleanup(&self) -> DebrisCleanupOptions

Source

pub fn set_debris_cleanup(&mut self, options: DebrisCleanupOptions)

Source

pub fn debris_collision_mode(&self) -> DebrisCollisionMode

Source

pub fn set_debris_collision_mode(&mut self, mode: DebrisCollisionMode)

Source

pub fn ground_body_handle(&self) -> Option<RigidBodyHandle>

Source

pub fn set_ground_body_handle(&mut self, handle: Option<RigidBodyHandle>)

Source

pub fn refresh_collision_groups( &self, bodies: &RigidBodySet, colliders: &mut ColliderSet, )

Source

pub fn dynamic_body_ccd_enabled(&self) -> bool

Source

pub fn set_dynamic_body_ccd_enabled(&mut self, enabled: bool)

Source

pub fn set_split_child_recentering_enabled(&mut self, enabled: bool)

Source

pub fn set_split_child_velocity_fit_enabled(&mut self, enabled: bool)

Source

pub fn pending_split_event_count(&self) -> usize

Source

pub fn pending_new_body_count(&self, bodies: &RigidBodySet) -> usize

Source

pub fn pending_collider_migration_count(&self, bodies: &RigidBodySet) -> usize

Source

pub fn needs_resimulation_snapshot(&self) -> bool

Source

pub fn capture_resimulation_snapshot( &self, bodies: &RigidBodySet, ) -> BodySnapshots

Source

pub fn mark_body_support_contact( &mut self, body_handle: RigidBodyHandle, now_secs: f32, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, ) -> bool

Source

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

Source§

type Target = DestructibleSet

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for DestructionRuntime

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.