pub struct PhysicsStepSystem2D { /* private fields */ }Expand description
System that steps the 2D physics simulation and writes positions back.
Each frame this system:
- Steps the physics provider by a fixed timestep (1/60 s).
- For each entity tracked in
PhysicsHandleMap2D, reads the body position from the provider and updates the entity’sTransform2D.
The system owns the physics provider. Users add bodies to the provider
directly and register the entity-to-handle mapping in PhysicsHandleMap2D.
Implementations§
Source§impl PhysicsStepSystem2D
impl PhysicsStepSystem2D
Sourcepub fn new(provider: Box<dyn PhysicsProvider>) -> Self
pub fn new(provider: Box<dyn PhysicsProvider>) -> Self
Creates a new 2D physics step system with the given provider.
Sourcepub fn provider(&self) -> &dyn PhysicsProvider
pub fn provider(&self) -> &dyn PhysicsProvider
Returns a reference to the underlying physics provider.
Sourcepub fn provider_mut(&mut self) -> &mut dyn PhysicsProvider
pub fn provider_mut(&mut self) -> &mut dyn PhysicsProvider
Returns a mutable reference to the underlying physics provider.
Trait Implementations§
Source§impl System for PhysicsStepSystem2D
impl System for PhysicsStepSystem2D
Source§fn component_access(&self) -> Access
fn component_access(&self) -> Access
Returns the component access pattern for this system. Read more
Source§fn initialize(&mut self, _world: &mut World)
fn initialize(&mut self, _world: &mut World)
Called once when the system is first added to a scheduler. Read more
Source§fn should_run(&self, _world: &World) -> bool
fn should_run(&self, _world: &World) -> bool
Returns whether this system should run. Read more
Source§fn is_read_only(&self) -> bool
fn is_read_only(&self) -> bool
Returns true if this system only reads data. Read more
Auto Trait Implementations§
impl Freeze for PhysicsStepSystem2D
impl !RefUnwindSafe for PhysicsStepSystem2D
impl Send for PhysicsStepSystem2D
impl Sync for PhysicsStepSystem2D
impl Unpin for PhysicsStepSystem2D
impl UnsafeUnpin for PhysicsStepSystem2D
impl !UnwindSafe for PhysicsStepSystem2D
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<S> IntoSystem for Swhere
S: System + 'static,
impl<S> IntoSystem for Swhere
S: System + 'static,
Source§fn into_system(self) -> BoxedSystem
fn into_system(self) -> BoxedSystem
Converts this into a system.