Skip to main content

World

Struct World 

Source
pub struct World { /* private fields */ }

Implementations§

Source§

impl World

Source

pub fn raycast( &self, origin: [f32; 3], direction: [f32; 3], max_distance: f32, filter: Filter, ) -> Option<Hit>

Source

pub fn shape_cast( &self, shape: &Shape, pose: Pose, direction: [f32; 3], max_distance: f32, filter: Filter, ) -> Option<Hit>

Source

pub fn point_overlaps(&self, point: [f32; 3], filter: Filter) -> Vec<ColliderId>

Source

pub fn shape_overlaps( &self, shape: &Shape, pose: Pose, filter: Filter, ) -> Vec<ColliderId>

Source§

impl World

Source

pub fn new(desc: WorldDesc) -> Self

Source

pub fn rate(&self) -> f32

Source

pub fn substeps(&self) -> u32

Source

pub fn dt(&self) -> f32

Source

pub fn steps(&self) -> u64

Source

pub fn time(&self) -> f64

Source

pub fn gravity(&self) -> [f32; 3]

Source

pub fn set_gravity(&mut self, gravity: [f32; 3])

Source

pub fn gravity_at(&self, point: [f32; 3]) -> [f32; 3]

Source

pub fn events(&self) -> &[Event]

Source

pub fn add_source(&mut self, source: Source) -> SourceId

Source

pub fn remove_source(&mut self, id: SourceId) -> bool

Source

pub fn source_mut(&mut self, id: SourceId) -> Option<&mut Source>

Source

pub fn add_body(&mut self, desc: BodyDesc) -> BodyId

Source

pub fn add_collider( &mut self, body: BodyId, desc: ColliderDesc, ) -> Option<ColliderId>

Source

pub fn remove_body(&mut self, body: BodyId) -> bool

Source

pub fn remove_collider(&mut self, collider: ColliderId) -> bool

Source

pub fn bodies(&self) -> Vec<BodyId>

Source

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

Source

pub fn pose(&self, body: BodyId) -> Option<Pose>

Source

pub fn mass(&self, body: BodyId) -> Option<f32>

Source

pub fn body_of(&self, collider: ColliderId) -> Option<BodyId>

Source

pub fn is_asleep(&self, body: BodyId) -> bool

Source

pub fn set_pose(&mut self, body: BodyId, to: Pose) -> bool

Source

pub fn set_velocity( &mut self, body: BodyId, linear: [f32; 3], angular: [f32; 3], ) -> bool

Source

pub fn apply_impulse(&mut self, body: BodyId, impulse: [f32; 3]) -> bool

Source

pub fn apply_impulse_at( &mut self, body: BodyId, impulse: [f32; 3], point: [f32; 3], ) -> bool

Source

pub fn apply_torque_impulse(&mut self, body: BodyId, impulse: [f32; 3]) -> bool

Source

pub fn add_force(&mut self, body: BodyId, force: [f32; 3]) -> bool

Source

pub fn add_force_at( &mut self, body: BodyId, force: [f32; 3], point: [f32; 3], ) -> bool

Source

pub fn add_torque(&mut self, body: BodyId, torque: [f32; 3]) -> bool

Source

pub fn set_gravity_scale(&mut self, body: BodyId, scale: f32) -> bool

Source

pub fn set_damping(&mut self, body: BodyId, linear: f32, angular: f32) -> bool

Source

pub fn set_ccd(&mut self, body: BodyId, ccd: bool) -> bool

Source

pub fn set_locks(&mut self, body: BodyId, locks: Locks) -> bool

Source

pub fn locks(&self, body: BodyId) -> Option<Locks>

Source

pub fn sleep(&mut self, body: BodyId) -> bool

Source

pub fn wake(&mut self, body: BodyId) -> bool

Source

pub fn set_drive(&mut self, body: BodyId, drive: Option<Drive>) -> bool

Source

pub fn drive(&self, body: BodyId) -> Option<&Drive>

Source

pub fn drive_mut(&mut self, body: BodyId) -> Option<&mut Drive>

Source

pub fn move_to(&mut self, body: BodyId, to: Pose) -> bool

Source

pub fn step(&mut self)

Source

pub fn refresh_queries(&mut self)

Source

pub fn run(&mut self, steps: u32)

Trait Implementations§

Source§

impl Default for World

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for World

§

impl !RefUnwindSafe for World

§

impl Send for World

§

impl Sync for World

§

impl Unpin for World

§

impl UnsafeUnpin for World

§

impl !UnwindSafe for World

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> MaybeSync for T
where T: Sync + ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,