Skip to main content

BodyTracker

Struct BodyTracker 

Source
pub struct BodyTracker { /* private fields */ }
Expand description

Tracks the mapping between stress graph nodes and Rapier rigid bodies.

Implementations§

Source§

impl BodyTracker

Source

pub fn new( nodes: &[ScenarioNode], node_sizes: Vec<Vec3>, node_colliders: Vec<Option<ScenarioCollider>>, ) -> Self

Create a new tracker from a scenario description.

Source

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

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 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 refresh_collision_groups( &self, bodies: &RigidBodySet, colliders: &mut ColliderSet, max_colliders_for_debris: usize, )

Source

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.

Source

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.

Source

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

Get the body handle for a node.

Source

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

Get the collider handle for a node.

Source

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

Get the node owning a collider.

Source

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

Get the node local offset relative to its owning body.

Source

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

Get the node indices attached to a 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 support (fixed) node.

Source

pub fn body_count(&self) -> usize

Number of tracked bodies.

Source

pub fn collider_count(&self) -> usize

Number of tracked colliders owned by destructible nodes.

Source

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

Number of dynamic bodies.

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 estimate_split_cost( &self, event: &SplitEvent, bodies: &RigidBodySet, ) -> SplitCost

Source

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

Source

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

Source

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§

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