Skip to main content

World

Struct World 

Source
pub struct World {
    pub camera: Camera,
    pub physics: World,
    pub sounds: Sounds,
    pub fx: Fx,
    pub rng: Rng,
    /* private fields */
}

Fields§

§camera: Camera§physics: World§sounds: Sounds§fx: Fx§rng: Rng

Implementations§

Source§

impl World

Source

pub fn play_clip(&mut self, id: ObjectId, clip: &str) -> Result<(), AnimError>

Source

pub fn animate(&mut self, id: ObjectId, clip: &str) -> Animate<'_>

Source

pub fn stop_animation(&mut self, id: ObjectId) -> bool

Source

pub fn animator(&self, id: ObjectId) -> Option<&Animator>

Source

pub fn animator_mut(&mut self, id: ObjectId) -> Option<&mut Animator>

Source

pub fn sprite(&self, id: ObjectId) -> Option<&SpritePlayer>

Source

pub fn sprite_mut(&mut self, id: ObjectId) -> Option<&mut SpritePlayer>

Source

pub fn palette(&self, id: ObjectId) -> Option<Vec<[[f32; 4]; 4]>>

Source

pub fn sprite_frame(&self, id: ObjectId) -> Option<[f32; 4]>

Source

pub fn animation_events(&self) -> &[AnimationEvent]

Source

pub fn animation_errors(&self) -> &[AnimError]

Source

pub fn posed(&self) -> Posed

Source§

impl World

Source

pub fn character(&mut self, id: ObjectId) -> Result<&mut Character, PlayError>

Source

pub fn set_character_desc( &mut self, id: ObjectId, desc: CharacterDesc, ) -> Result<(), PlayError>

Source

pub fn character_of(&self, id: ObjectId) -> Option<&Character>

Source

pub fn characters(&self) -> impl Iterator<Item = (ObjectId, &Character)>

Source

pub fn character_desc(&self, id: ObjectId) -> Option<&CharacterDesc>

Source

pub fn remove_character(&mut self, id: ObjectId) -> bool

Source§

impl World

Source

pub fn apply(&mut self, edit: &Edit) -> Result<Edit, String>

Source§

impl World

Source

pub fn raycast( &self, origin: [f32; 3], direction: [f32; 3], max_distance: f32, query: &Query, ) -> Result<Option<Hit>, QueryError>

Source

pub fn shape_cast( &self, shape_of: BodyShape, at: [f32; 3], rotation: [f32; 4], direction: [f32; 3], max_distance: f32, query: &Query, ) -> Result<Option<Hit>, QueryError>

Source

pub fn overlaps( &self, shape_of: BodyShape, at: [f32; 3], rotation: [f32; 4], query: &Query, ) -> Result<Vec<Overlap>, QueryError>

Source

pub fn overlaps_point( &self, point: [f32; 3], query: &Query, ) -> Result<Vec<Overlap>, QueryError>

Source§

impl World

Source

pub fn rig_names(&self) -> impl Iterator<Item = &str>

Source

pub fn rig_desc(&self, name: &str) -> Option<&RigDesc>

Source

pub fn rig_state(&self, name: &str) -> Option<&Rig>

Source

pub fn rig_state_mut(&mut self, name: &str) -> Option<&mut Rig>

Source

pub fn active_rig(&self) -> Option<&str>

Source

pub fn rig(&mut self, name: &str) -> bool

Source

pub fn rig_off(&mut self)

Source

pub fn rig_target(&mut self, name: &str, target: Option<&str>) -> bool

Source

pub fn rig_look(&mut self, mouse: [f32; 2])

Source

pub fn set_view_aspect(&mut self, aspect: f32)

Source

pub fn rig_grounded(&mut self, grounded: bool)

Source§

impl World

Source

pub fn scene(&self) -> &Scene

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn object(&self, name: &str) -> Option<ObjectId>

Source

pub fn ids(&self) -> impl Iterator<Item = ObjectId>

Source

pub fn name(&self, id: ObjectId) -> &str

Source

pub fn parent(&self, id: ObjectId) -> Option<ObjectId>

Source

pub fn rest(&self, id: ObjectId) -> [[f32; 4]; 4]

Source

pub fn local(&self, id: ObjectId) -> [[f32; 4]; 4]

Source

pub fn set_local(&mut self, id: ObjectId, local: [[f32; 4]; 4])

Source

pub fn model(&self, id: ObjectId) -> [[f32; 4]; 4]

Source

pub fn models(&self) -> Vec<[[f32; 4]; 4]>

Source

pub fn set_model(&mut self, id: ObjectId, world: [[f32; 4]; 4]) -> bool

Source

pub fn at(&self, id: ObjectId) -> [f32; 3]

Source

pub fn place(&mut self, id: ObjectId, at: [f32; 3], rotation: [f32; 4]) -> bool

Source

pub fn move_to(&mut self, id: ObjectId, at: [f32; 3]) -> bool

Source

pub fn hidden(&self, id: ObjectId) -> bool

Source

pub fn set_hidden(&mut self, id: ObjectId, hidden: bool) -> bool

Source

pub fn look(&self, id: ObjectId) -> &Look

Source

pub fn set_look(&mut self, id: ObjectId, look: Look)

Source

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

Source

pub fn body_desc(&self, id: ObjectId) -> Option<&Body>

Source

pub fn material(&self, name: &str) -> Option<Material>

Source

pub fn edited_materials(&self) -> &BTreeMap<String, Material>

Source

pub fn light(&self, name: &str) -> Option<&Light>

Source

pub fn lights(&self) -> &BTreeMap<String, Light>

Source

pub fn set_light(&mut self, name: &str, light: Light) -> bool

Source

pub fn exposure(&self) -> f32

Source

pub fn set_exposure(&mut self, exposure: f32) -> bool

Source

pub fn sound_level(&self, name: &str) -> Option<SoundLevel>

Source

pub fn tunables(&self) -> &Tunables

Source

pub fn tunable<T>(&self, name: &str) -> Option<T>
where T: FromTunable,

Source

pub fn set_tunable( &mut self, name: &str, value: TunableValue, ) -> Result<TunableValue, String>

Source

pub fn contacts(&self) -> &[Contact]

Source

pub fn ticks(&self) -> u64

Source

pub fn time(&self) -> f64

Source

pub fn clock(&self) -> &Clock

Source

pub fn hit_stop(&mut self, stop: HitStop)

Source

pub fn set_speed(&mut self, speed: f32)

Source

pub fn state<T>(&self) -> Option<&T>
where T: Any,

Source

pub fn state_mut<T>(&mut self) -> Option<&mut T>
where T: Any,

Source

pub fn set_state<T>(&mut self, state: T)
where T: Any,

Source

pub fn play_sound(&mut self, name: &str) -> bool

Source

pub fn play_cued(&mut self, cue: Cue) -> usize

Source

pub fn play_hits(&mut self) -> usize

Source

pub fn pose_movers(&mut self)

Source

pub fn set_cursor(&mut self, cursor: Cursor)

Source

pub fn cursor(&self) -> Cursor

Source

pub fn warp_pointer(&mut self, point: [f32; 2])

Source

pub fn take_warp(&mut self) -> Option<[f32; 2]>

Source

pub fn rumble(&mut self, rumble: Rumble)

Source

pub fn rumble_pad(&mut self, pad: PadId, rumble: Rumble)

Source

pub fn rumble_queue(&self) -> &[RumbleRequest]

Source

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

Source

pub fn layers(&self) -> &Layers

Source

pub fn is_trigger(&self, id: ObjectId) -> bool

Source

pub fn inside(&self, trigger: ObjectId) -> Vec<ObjectId>

Source

pub fn quit(&mut self, code: u8)

Source

pub fn fail(&mut self, error: impl Display)

Source

pub fn exit(&self) -> Option<&Exit>

Source

pub fn display(&self) -> &DisplaySettings

Source

pub fn audio_due(&self) -> usize

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

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<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

§

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

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

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