pub struct IslandManager { /* private fields */ }Expand description
System that manages which bodies are active (awake) vs sleeping to optimize performance.
§Sleeping Optimization
Bodies at rest automatically “sleep” - they’re excluded from simulation until something disturbs them (collision, joint connection to moving body, manual wake-up). This can dramatically improve performance in scenes with many static/resting objects.
§Islands
Connected bodies (via contacts or joints) are grouped into “islands” that are solved together. This allows parallel solving and better organization.
You rarely interact with this directly - it’s automatically managed by PhysicsPipeline.
Implementations§
Source§impl IslandManager
impl IslandManager
Sourcepub fn cleanup_removed_rigid_bodies(&mut self, bodies: &mut RigidBodySet)
pub fn cleanup_removed_rigid_bodies(&mut self, bodies: &mut RigidBodySet)
Update this data-structure after one or multiple rigid-bodies have been removed for bodies.
Sourcepub fn wake_up(
&mut self,
bodies: &mut RigidBodySet,
handle: RigidBodyHandle,
strong: bool,
)
pub fn wake_up( &mut self, bodies: &mut RigidBodySet, handle: RigidBodyHandle, strong: bool, )
Wakes up a sleeping body, forcing it back into the active simulation.
Use this when you want to ensure a body is active (useful after manually moving a sleeping body, or to prevent it from sleeping in the next few frames).
§Parameters
strong- Iftrue, the body is guaranteed to stay awake for multiple frames. Iffalse, it might sleep again immediately if conditions are met.
§Example
islands.wake_up(&mut bodies, body_handle, true);
let body = bodies.get_mut(body_handle).unwrap();
// Wake up a body before applying force to it
body.add_force(vector![100.0, 0.0, 0.0], false);Only affects dynamic bodies (kinematic and fixed bodies don’t sleep).
Sourcepub fn active_bodies(&self) -> &[RigidBodyHandle]
pub fn active_bodies(&self) -> &[RigidBodyHandle]
Handls of dynamic and kinematic rigid-bodies that are currently active (i.e. not sleeping).
Trait Implementations§
Source§impl Clone for IslandManager
impl Clone for IslandManager
Source§fn clone(&self) -> IslandManager
fn clone(&self) -> IslandManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for IslandManager
impl Default for IslandManager
Source§fn default() -> IslandManager
fn default() -> IslandManager
Auto Trait Implementations§
impl Freeze for IslandManager
impl RefUnwindSafe for IslandManager
impl Send for IslandManager
impl Sync for IslandManager
impl Unpin for IslandManager
impl UnwindSafe for IslandManager
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> 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 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>
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.