Struct let_engine::objects::Object
source · pub struct Object {
pub transform: Transform,
pub appearance: Appearance,
/* private fields */
}
Expand description
An initialized object that gets rendered on the screen.
Fields§
§transform: Transform
§appearance: Appearance
Implementations§
source§impl Object
impl Object
pub fn layer(&self) -> &Arc<Layer>
sourcepub fn set_isometry(&mut self, position: Vec2, rotation: f32)
pub fn set_isometry(&mut self, position: Vec2, rotation: f32)
Sets the position and rotation of an object.
sourcepub fn public_transform(&self) -> Transform
pub fn public_transform(&self) -> Transform
Returns the public position where the object is going to be rendered.
sourcepub fn appearance(&self) -> &Appearance
pub fn appearance(&self) -> &Appearance
Returns a reference to the appearance of the object.
sourcepub fn id(&self) -> usize
pub fn id(&self) -> usize
Returns the identification number of the object specific the layer it is inside right now.
Returns 0 in case it is not initialized to a layer yet.
source§impl Object
impl Object
Physics
sourcepub fn collider(&self) -> Option<&Collider>
pub fn collider(&self) -> Option<&Collider>
Returns the collider of the object in case it has one.
sourcepub fn set_collider(&mut self, collider: Option<Collider>)
pub fn set_collider(&mut self, collider: Option<Collider>)
Sets the collider of the object.
sourcepub fn collider_mut(&mut self) -> Option<&mut Collider>
pub fn collider_mut(&mut self) -> Option<&mut Collider>
Returns a mutable reference to the collider.
sourcepub fn rigid_body(&self) -> Option<&RigidBody>
pub fn rigid_body(&self) -> Option<&RigidBody>
Returns the rigid bodyh of the object in case it has one.
sourcepub fn set_rigid_body(&mut self, rigid_body: Option<RigidBody>)
pub fn set_rigid_body(&mut self, rigid_body: Option<RigidBody>)
Sets the rigid body of the object.
sourcepub fn rigid_body_mut(&mut self) -> Option<&mut RigidBody>
pub fn rigid_body_mut(&mut self) -> Option<&mut RigidBody>
Returns a mutable reference to the rigid body.
sourcepub fn local_collider_position(&self) -> Vec2
pub fn local_collider_position(&self) -> Vec2
Returns the local position of the collider.
sourcepub fn set_local_collider_position(&mut self, pos: Vec2)
pub fn set_local_collider_position(&mut self, pos: Vec2)
Sets the local position of the collider of this object in case it has one.
Trait Implementations§
source§impl PartialEq for Object
impl PartialEq for Object
impl Eq for Object
Auto Trait Implementations§
impl !RefUnwindSafe for Object
impl Send for Object
impl Sync for Object
impl Unpin for Object
impl !UnwindSafe for Object
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§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
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.