pub struct BodyTracker { /* private fields */ }Expand description
Tracks the mapping between stress graph nodes and Rapier rigid bodies.
Implementations§
Source§impl BodyTracker
impl BodyTracker
Sourcepub fn new(
nodes: &[ScenarioNode],
node_sizes: Vec<Vec3>,
node_colliders: Vec<Option<ScenarioCollider>>,
) -> Self
pub fn new( nodes: &[ScenarioNode], node_sizes: Vec<Vec3>, node_colliders: Vec<Option<ScenarioCollider>>, ) -> Self
Create a new tracker from a scenario description.
pub fn set_dynamic_body_ccd_enabled(&mut self, enabled: bool)
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 set_split_child_recentering_enabled(&mut self, enabled: bool)
pub fn set_split_child_velocity_fit_enabled(&mut self, enabled: bool)
pub fn refresh_collision_groups( &self, bodies: &RigidBodySet, colliders: &mut ColliderSet, max_colliders_for_debris: usize, )
Sourcepub fn create_initial_bodies(
&mut self,
actors: &[Actor],
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
created_at: f32,
small_body_damping: SmallBodyDampingOptions,
sleep_thresholds: SleepThresholdOptions,
max_colliders_for_debris: usize,
) -> Vec<RigidBodyHandle>
pub fn create_initial_bodies( &mut self, actors: &[Actor], bodies: &mut RigidBodySet, colliders: &mut ColliderSet, created_at: f32, small_body_damping: SmallBodyDampingOptions, sleep_thresholds: SleepThresholdOptions, max_colliders_for_debris: usize, ) -> Vec<RigidBodyHandle>
Create initial Rapier bodies from the actor table.
Each actor becomes one rigid body. Support-only actors become fixed bodies. Returns the list of created body handles.
Sourcepub fn handle_split(
&mut self,
event: &SplitEvent,
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
island_manager: &mut IslandManager,
impulse_joints: &mut ImpulseJointSet,
multibody_joints: &mut MultibodyJointSet,
created_at: f32,
small_body_damping: SmallBodyDampingOptions,
sleep_thresholds: SleepThresholdOptions,
max_colliders_for_debris: usize,
) -> SplitApplyResult
pub fn handle_split( &mut self, event: &SplitEvent, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, island_manager: &mut IslandManager, impulse_joints: &mut ImpulseJointSet, multibody_joints: &mut MultibodyJointSet, created_at: f32, small_body_damping: SmallBodyDampingOptions, sleep_thresholds: SleepThresholdOptions, max_colliders_for_debris: usize, ) -> SplitApplyResult
Handle a split event: create new bodies for child actors.
Returns newly created body handles.
Sourcepub fn node_body(&self, node_index: u32) -> Option<RigidBodyHandle>
pub fn node_body(&self, node_index: u32) -> Option<RigidBodyHandle>
Get the 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 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 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 local offset relative to its owning 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 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 support (fixed) node.
Sourcepub fn body_count(&self) -> usize
pub fn body_count(&self) -> usize
Number of tracked bodies.
Sourcepub fn collider_count(&self) -> usize
pub fn collider_count(&self) -> usize
Number of tracked colliders owned by destructible nodes.
Sourcepub fn dynamic_body_count(&self, bodies: &RigidBodySet) -> usize
pub fn dynamic_body_count(&self, bodies: &RigidBodySet) -> usize
Number of dynamic bodies.
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
pub fn estimate_split_cost( &self, event: &SplitEvent, bodies: &RigidBodySet, ) -> SplitCost
pub fn mark_support_contact( &mut self, body_handle: RigidBodyHandle, now_secs: f32, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, damping: SmallBodyDampingOptions, sleep_thresholds: SleepThresholdOptions, max_colliders_for_debris: usize, ) -> bool
pub fn cleanup_expired_bodies( &mut self, now_secs: f32, cleanup: DebrisCleanupOptions, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, island_manager: &mut IslandManager, impulse_joints: &mut ImpulseJointSet, multibody_joints: &mut MultibodyJointSet, ) -> OptimizationResult
pub fn destroy_nodes( &mut self, nodes: &[u32], bodies: &mut RigidBodySet, colliders: &mut ColliderSet, island_manager: &mut IslandManager, impulse_joints: &mut ImpulseJointSet, multibody_joints: &mut MultibodyJointSet, ) -> Vec<u32>
Auto Trait Implementations§
impl Freeze for BodyTracker
impl RefUnwindSafe for BodyTracker
impl Send for BodyTracker
impl Sync for BodyTracker
impl Unpin for BodyTracker
impl UnsafeUnpin for BodyTracker
impl UnwindSafe for BodyTracker
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
Mutably borrows from an owned value. Read more
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>
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>
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)
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)
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
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>
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 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>
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 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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.