Skip to main content

PhysicsSystem

Struct PhysicsSystem 

Source
pub struct PhysicsSystem { /* private fields */ }
Expand description

Rigid-body simulation behavior. Constructed internally by World::start from the world’s PhysicsConfig; never a declarable asset.

new steps the simulation on the calling thread; a host lends it threads through with_fanout.

Implementations§

Source§

impl PhysicsSystem

Source

pub fn new(config: PhysicsConfig) -> Self

Build the simulation from the world’s PhysicsConfig (floor / terrain). Bodies and colliders are added from the ECS in System::init.

Source

pub fn with_fanout(self, fanout: Box<dyn PhysicsFanout>) -> Self

Run the step’s independent work through fanout rather than on the calling thread. What a step hands out and the order its results load back in are the simulation’s; a fan-out decides only where the work runs, so this cannot change the state a tick lands on.

Trait Implementations§

Source§

impl Debug for PhysicsSystem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl System for PhysicsSystem

Source§

fn init(&mut self, ctx: &mut PipelineContext<'_>)

Run once at World::start, before the first step.
Source§

fn step(&mut self, ctx: &mut PipelineContext<'_>) -> StepResult

Run once per tick.
Source§

fn access(&self) -> Access

The data step may touch, consulted once when the schedule is built (after init, so a data-dependent system can compute it from its compiled state). The default claims everything: an undeclared system is ordered against all others and never runs concurrently, which is always safe. Declaring narrower access is what admits a system to shared waves and to debug-build access validation.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.