pub struct SoftBodySet { /* private fields */ }Expand description
A set of soft bodies that can be handled by a physics pipeline. Inserting a soft body creates
its hidden root rigid body in the RigidBodySet (see SoftBody) and its colliders in the
ColliderSet; removing it removes them, so never remove those yourself.
Implementations§
Source§impl SoftBodySet
impl SoftBodySet
Sourcepub fn contains(&self, handle: SoftBodyHandle) -> bool
pub fn contains(&self, handle: SoftBodyHandle) -> bool
Whether the given handle identifies a soft body of this set.
Sourcepub fn get(&self, handle: SoftBodyHandle) -> Option<&SoftBody>
pub fn get(&self, handle: SoftBodyHandle) -> Option<&SoftBody>
The soft body with the given handle.
Sourcepub fn get_mut(&mut self, handle: SoftBodyHandle) -> Option<&mut SoftBody>
pub fn get_mut(&mut self, handle: SoftBodyHandle) -> Option<&mut SoftBody>
The soft body with the given handle.
Sourcepub fn iter(&self) -> impl ExactSizeIterator<Item = (SoftBodyHandle, &SoftBody)>
pub fn iter(&self) -> impl ExactSizeIterator<Item = (SoftBodyHandle, &SoftBody)>
Iterates over the soft bodies of this set.
Sourcepub fn iter_mut(
&mut self,
) -> impl ExactSizeIterator<Item = (SoftBodyHandle, &mut SoftBody)>
pub fn iter_mut( &mut self, ) -> impl ExactSizeIterator<Item = (SoftBodyHandle, &mut SoftBody)>
Iterates mutably over the soft bodies of this set.
Source§impl SoftBodySet
impl SoftBodySet
Sourcepub fn add_cluster(
&mut self,
handle: SoftBodyHandle,
particles: &[u32],
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
) -> Option<u32>
pub fn add_cluster( &mut self, handle: SoftBodyHandle, particles: &[u32], bodies: &mut RigidBodySet, colliders: &mut ColliderSet, ) -> Option<u32>
Adds a cluster to a soft body: a set of its particles (invalid indices ignored, duplicates
merged) backed by a fresh crate::dynamics::RigidBodyType::SoftFrame proxy body that
joints and colliders attach to. Returns its stable index, None if nothing valid remains.
Sourcepub fn remove_cluster(
&mut self,
handle: SoftBodyHandle,
cluster: u32,
islands: &mut IslandManager,
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
impulse_joints: &mut ImpulseJointSet,
multibody_joints: &mut MultibodyJointSet,
) -> Option<SoftClusterRemoval>
pub fn remove_cluster( &mut self, handle: SoftBodyHandle, cluster: u32, islands: &mut IslandManager, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, impulse_joints: &mut ImpulseJointSet, multibody_joints: &mut MultibodyJointSet, ) -> Option<SoftClusterRemoval>
Removes the cluster-th cluster of a soft body, its proxy rigid body, and the particles
only this cluster covered (with their elements and attachments); removing the last cluster
removes the body. Returns what was deleted, or None if the body or cluster is missing.
Source§impl SoftBodySet
impl SoftBodySet
Sourcepub fn insert(
&mut self,
soft_body_builder: SoftBodyBuilder,
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
) -> SoftBodyHandle
pub fn insert( &mut self, soft_body_builder: SoftBodyBuilder, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, ) -> SoftBodyHandle
Inserts a soft body, creating its root rigid body and the deformable colliders of its collision meshes from the collider template; its element topology must index valid particles.
Sourcepub fn remove(
&mut self,
handle: SoftBodyHandle,
islands: &mut IslandManager,
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
impulse_joints: &mut ImpulseJointSet,
multibody_joints: &mut MultibodyJointSet,
) -> Option<SoftBody>
pub fn remove( &mut self, handle: SoftBodyHandle, islands: &mut IslandManager, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, impulse_joints: &mut ImpulseJointSet, multibody_joints: &mut MultibodyJointSet, ) -> Option<SoftBody>
Removes a soft body, its cluster proxies (root rigid body included) and its colliders.
Source§impl SoftBodySet
impl SoftBodySet
Sourcepub fn sync_particle_positions(
&mut self,
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
params: &IntegrationParameters,
quarantined: &mut Vec<SoftBodyHandle>,
)
pub fn sync_particle_positions( &mut self, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, params: &IntegrationParameters, quarantined: &mut Vec<SoftBodyHandle>, )
Updates each soft body’s derived state at the end of a step: surface orientation, sleep state, colliders of the awake ones, the coming step’s speculative margin and the impact-adaptive substep request. A body with a non-finite particle is quarantined.
Sourcepub fn tear(
&mut self,
handle: SoftBodyHandle,
edges: &[u32],
cells: &[u32],
islands: &mut IslandManager,
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
impulse_joints: &mut ImpulseJointSet,
multibody_joints: &mut MultibodyJointSet,
) -> Option<SoftBodyTearEvent>
pub fn tear( &mut self, handle: SoftBodyHandle, edges: &[u32], cells: &[u32], islands: &mut IslandManager, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, impulse_joints: &mut ImpulseJointSet, multibody_joints: &mut MultibodyJointSet, ) -> Option<SoftBodyTearEvent>
Tears a soft body right away and rebuilds its colliders, losing no material: a crack opens
through a particle of every torn edge and cell (see SoftBody::tear_edge), disconnected
pieces become soft bodies, crossed clusters split. Returns the event, None if unchanged.
Sourcepub fn cut(
&mut self,
handle: SoftBodyHandle,
blade: &[Vector; 3],
islands: &mut IslandManager,
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
impulse_joints: &mut ImpulseJointSet,
multibody_joints: &mut MultibodyJointSet,
) -> Option<SoftBodyTearEvent>
pub fn cut( &mut self, handle: SoftBodyHandle, blade: &[Vector; 3], islands: &mut IslandManager, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, impulse_joints: &mut ImpulseJointSet, multibody_joints: &mut MultibodyJointSet, ) -> Option<SoftBodyTearEvent>
Cuts a soft body right away along a blade, a world segment (2D) or triangle (3D), splitting
the particles of the edges the blade meets (pinned ones never) and losing no material (see
SoftBody::rest_measure). Returns the tear event, or None when nothing changed.
Sourcepub fn wake_up(
&mut self,
handle: SoftBodyHandle,
bodies: &mut RigidBodySet,
strong: bool,
)
pub fn wake_up( &mut self, handle: SoftBodyHandle, bodies: &mut RigidBodySet, strong: bool, )
Wakes up the given soft body (effective at the start of the next step).
Trait Implementations§
Source§impl Clone for SoftBodySet
impl Clone for SoftBodySet
Source§fn clone(&self) -> SoftBodySet
fn clone(&self) -> SoftBodySet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for SoftBodySet
impl Default for SoftBodySet
Source§fn default() -> SoftBodySet
fn default() -> SoftBodySet
Source§impl Index<SoftBodyHandle> for SoftBodySet
impl Index<SoftBodyHandle> for SoftBodySet
Source§impl IndexMut<SoftBodyHandle> for SoftBodySet
impl IndexMut<SoftBodyHandle> for SoftBodySet
Auto Trait Implementations§
impl Freeze for SoftBodySet
impl RefUnwindSafe for SoftBodySet
impl Send for SoftBodySet
impl Sync for SoftBodySet
impl Unpin for SoftBodySet
impl UnsafeUnpin for SoftBodySet
impl UnwindSafe for SoftBodySet
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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 moreimpl<T> MaybeSync for T
Source§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.