Skip to main content

Physics

Struct Physics 

Source
pub struct Physics<S: PhysicsSpace> { /* private fields */ }

Implementations§

Source§

impl<S> Physics<S>
where S: Homogeneous + PhysicsSpace + Copy, S::Vector: VectorOps + Default, S::Point: Sub<Output = S::Vector>,

Source

pub fn world(&self) -> &World<S>

Source

pub fn narrowphase_mut(&mut self) -> &mut Narrowphase<S>

Source

pub fn set_solver_iterations(&mut self, iterations: usize)

Source

pub fn set_grab_hold(&mut self, hold: GrabHold)

Has no effect on a domain built without a grab.

Source

pub fn set_gravity( &mut self, gravity: Option<S::Vector>, ) -> Result<(), EditError>

Source

pub fn set_solver_tolerance(&mut self, tolerance: f32) -> Result<(), EditError>

Source

pub fn body(&self, entity: Entity) -> Option<BodyId>

Source

pub fn entity(&self, body: BodyId) -> Option<Entity>

Source

pub fn set_velocity( &mut self, entity: Entity, velocity: S::Vector, angular_velocity: S::AngVel, ) -> Result<(), EditError>

Source

pub fn set_restitution( &mut self, entity: Entity, restitution: f32, ) -> Result<(), EditError>

Source

pub fn set_collision_filter( &mut self, entity: Entity, group: u32, mask: u32, ) -> Result<(), EditError>

Source

pub fn set_mass_properties( &mut self, entity: Entity, mass: f32, inertia: S::Inertia, ) -> Result<(), EditError>

Source

pub fn set_collider( &mut self, entity: Entity, collider: Collider, inertia: S::Inertia, ) -> Result<(), EditError>

Source

pub fn sleep_body(&mut self, entity: Entity) -> Result<(), EditError>

Source

pub fn wake_body(&mut self, entity: Entity) -> Result<(), EditError>

Source

pub fn is_held(&self, entity: Entity) -> bool

Source

pub fn held_anchor(&self, entity: Entity) -> Option<S::Point>

Source

pub fn throw( &mut self, entity: Entity, velocity: S::Vector, ) -> Result<(), EditError>

Source

pub fn released_anchor(&self, entity: Entity) -> Option<S::Point>

The grab point of the body released last, moved with the body since.

Source

pub fn despawn(&mut self, entity: Entity) -> Option<BodyId>

Trait Implementations§

Source§

impl<S> Facility<S> for Physics<S>
where S: Homogeneous + PhysicsSpace + Copy, S::Vector: VectorOps + Default, S::AngVel: PartialEq, S::Point: Sub<Output = S::Vector>,

Source§

fn name(&self) -> &'static str

Source§

fn bind(&mut self, scene: SceneId, _owner: Owner)

Source§

fn step( &mut self, poses: &mut Store<Pose<S>>, step: Step, _owner: Owner, ) -> Result<(), DomainError>

Source§

fn synchronize(&mut self, poses: &mut Store<Pose<S>>, _owner: Owner)

Source§

fn set_pose( &mut self, entity: Entity, pose: Pose<S>, poses: &mut Store<Pose<S>>, _owner: Owner, ) -> Option<Result<(), DomainError>>

Source§

fn move_to( &mut self, entity: Entity, point: S::Point, poses: &mut Store<Pose<S>>, _owner: Owner, ) -> Option<Result<(), DomainError>>

Source§

fn snapshot(&self, _owner: Owner) -> Box<dyn Any + Send>

Source§

fn check_restore( &self, from: &(dyn Any + Send), _owner: Owner, ) -> Result<(), RestoreError>

Refuses whatever restore would refuse, changing nothing; the session calls it on every facility before the first one restores.
Source§

fn restore( &mut self, from: &(dyn Any + Send), _owner: Owner, ) -> Result<(), RestoreError>

Source§

fn release(&mut self, entity: Entity, _owner: Owner)

Source§

fn apply( &mut self, command: &ChartCommand, poses: &mut Store<Pose<S>>, _owner: Owner, ) -> Option<Result<Outcome, Rejection>>

Some claims the command with its outcome; None leaves it to the domain.

Auto Trait Implementations§

§

impl<S> Freeze for Physics<S>
where S: Freeze, <S as Space>::Vector: Freeze, <S as Space>::Point: Freeze,

§

impl<S> !RefUnwindSafe for Physics<S>

§

impl<S> Send for Physics<S>

§

impl<S> Sync for Physics<S>

§

impl<S> Unpin for Physics<S>
where S: Unpin, <S as Space>::Vector: Unpin, <S as Space>::Point: Unpin, <S as IsometryGroup>::Iso: Unpin, <S as PhysicsSpace>::AngVel: Unpin, <S as PhysicsSpace>::Inertia: Unpin,

§

impl<S> UnsafeUnpin for Physics<S>
where S: UnsafeUnpin, <S as Space>::Vector: UnsafeUnpin, <S as Space>::Point: UnsafeUnpin,

§

impl<S> !UnwindSafe for Physics<S>

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = Infallible

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more