pub struct SoftBodyTearEvent {
pub soft_body: SoftBodyHandle,
pub torn_edges: Vec<[u32; 2]>,
pub torn_cells: Vec<[u32; 4]>,
pub removed_edges: Vec<[u32; 2]>,
pub split_particles: Vec<(u32, u32)>,
pub inserted_particles: Vec<u32>,
pub pieces: Vec<SoftBodyPiece>,
pub clusters: Vec<SoftClusterSplit>,
pub moved_joints: Vec<SoftJointMove>,
}Expand description
What a tear or a cut did to a soft body (see EventHandler::handle_soft_body_tear_event,
crate::dynamics::SoftBodySet::tear and crate::dynamics::SoftBodySet::cut); the
indices of torn_edges/torn_cells predate the tear, the others follow it, before the split.
Fields§
§soft_body: SoftBodyHandleThe soft body that tore.
torn_edges: Vec<[u32; 2]>The particle pairs of the torn edges a crack opened across. In a cut, the edges the blade
meets (see crate::dynamics::SoftBody::crossing_elements).
torn_cells: Vec<[u32; 4]>The vertices of the torn cells a crack opened through (a tear removes no cell). In a cut, the cells the blade meets.
removed_edges: Vec<[u32; 2]>The particle pairs of the edges removed for straddling an opened crack: bending edges over a split particle, quad diagonals across an opened triangle side, edges joining two pieces.
split_particles: Vec<(u32, u32)>The particles the tear passed through, duplicated one copy per piece: (copy, source).
inserted_particles: Vec<u32>The particles a cut inserted where it crosses a rope, polyline or wire segment: two per crossed segment, both at the crossing, the first joined to the segment’s first particle.
pieces: Vec<SoftBodyPiece>The soft bodies the torn body came apart into, the piece with the largest rest measure (which keeps the handle) first, the others new soft bodies remembering their origin. Empty when nothing split off; else the first entry maps the retained body’s compacted particles.
clusters: Vec<SoftClusterSplit>The pieces of every cluster the crack split (see
crate::dynamics::SoftBody::seeded_components): one piece keeps the proxy, the others
get a fresh one. Empty when no cluster was split.
moved_joints: Vec<SoftJointMove>The impulse joints moved to another proxy by a cluster split: a joint follows the piece closest to its anchor in the rest shape.
Implementations§
Source§impl SoftBodyTearEvent
impl SoftBodyTearEvent
Sourcepub fn bodies(&self) -> impl Iterator<Item = SoftBodyHandle> + '_
pub fn bodies(&self) -> impl Iterator<Item = SoftBodyHandle> + '_
The soft bodies the torn body is in after the tear, the one keeping the handle first: the
torn body alone when nothing was split off, the Self::pieces otherwise.
Sourcepub fn particle_destination(
&self,
particle: u32,
) -> Option<(SoftBodyHandle, u32)>
pub fn particle_destination( &self, particle: u32, ) -> Option<(SoftBodyHandle, u32)>
Where the particle particle of the torn body (a post-tear index, as the other fields
use) is now: the soft body holding it and its index there. None for an index the torn
body never had.
Trait Implementations§
Source§impl Clone for SoftBodyTearEvent
impl Clone for SoftBodyTearEvent
Source§fn clone(&self) -> SoftBodyTearEvent
fn clone(&self) -> SoftBodyTearEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SoftBodyTearEvent
impl Debug for SoftBodyTearEvent
Source§impl Default for SoftBodyTearEvent
impl Default for SoftBodyTearEvent
Source§fn default() -> SoftBodyTearEvent
fn default() -> SoftBodyTearEvent
Auto Trait Implementations§
impl Freeze for SoftBodyTearEvent
impl RefUnwindSafe for SoftBodyTearEvent
impl Send for SoftBodyTearEvent
impl Sync for SoftBodyTearEvent
impl Unpin for SoftBodyTearEvent
impl UnsafeUnpin for SoftBodyTearEvent
impl UnwindSafe for SoftBodyTearEvent
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.