pub struct MultiWorld {
pub worlds: Vec<PhysicsWorld>,
}Expand description
Container managing multiple independent physics worlds.
Fields§
§worlds: Vec<PhysicsWorld>All physics worlds
Implementations§
Source§impl MultiWorld
impl MultiWorld
Sourcepub fn add_world(&mut self, config: PhysicsConfig) -> usize
pub fn add_world(&mut self, config: PhysicsConfig) -> usize
Add a new physics world with the given configuration.
Returns the index of the newly added world.
Sourcepub fn step_all(&mut self, dt: Fix128)
pub fn step_all(&mut self, dt: Fix128)
Step all worlds sequentially.
Each world is advanced by dt independently.
Sourcepub fn step_all_parallel(&mut self, dt: Fix128)
pub fn step_all_parallel(&mut self, dt: Fix128)
Step all worlds in parallel using Rayon.
Each world is advanced by dt independently on separate threads.
Requires the parallel feature.
Sourcepub fn transfer_body(
&mut self,
from_world: usize,
body_id: usize,
to_world: usize,
new_position: Vec3Fix,
) -> Option<usize>
pub fn transfer_body( &mut self, from_world: usize, body_id: usize, to_world: usize, new_position: Vec3Fix, ) -> Option<usize>
Transfer a rigid body from one world to another.
Removes the body from from_world and adds it to to_world
at the given new_position. Returns the body’s new index in
the destination world, or None if the indices are invalid.
§Arguments
from_world: Source world indexbody_id: Body index within the source worldto_world: Destination world indexnew_position: Position in the destination world
Sourcepub fn world_count(&self) -> usize
pub fn world_count(&self) -> usize
Get the number of worlds.
Sourcepub fn total_body_count(&self) -> usize
pub fn total_body_count(&self) -> usize
Get the total number of bodies across all worlds.
Trait Implementations§
Source§impl Debug for MultiWorld
impl Debug for MultiWorld
Auto Trait Implementations§
impl !RefUnwindSafe for MultiWorld
impl !UnwindSafe for MultiWorld
impl Freeze for MultiWorld
impl Send for MultiWorld
impl Sync for MultiWorld
impl Unpin for MultiWorld
impl UnsafeUnpin for MultiWorld
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> 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 more