pub struct Transform { /* private fields */ }Expand description
The transform component. Contains all information about the place of an entity in 3D space.
Implementations§
Source§impl Transform
impl Transform
Sourcepub fn with_pos(pos: Vec3) -> Self
pub fn with_pos(pos: Vec3) -> Self
Creates a new transform with the given position, but with identity scale and rotation
Sourcepub fn with_rot(rot: Quat) -> Self
pub fn with_rot(rot: Quat) -> Self
Creates a new transform with the given rotation, but with identity position and scale
Sourcepub fn with_scale(scale: Vec3) -> Self
pub fn with_scale(scale: Vec3) -> Self
Creates a new transform with the given scale, but with identity position and rotation
Sourcepub fn with_pos_rot(pos: Vec3, rot: Quat) -> Self
pub fn with_pos_rot(pos: Vec3, rot: Quat) -> Self
Creates a new transform with the given position and rotation, but with identity scale
Sourcepub fn with_pos_rot_scale(pos: Vec3, rot: Quat, scale: Vec3) -> Self
pub fn with_pos_rot_scale(pos: Vec3, rot: Quat, scale: Vec3) -> Self
Creates a new transform with the given local position, rotation and scale
Sourcepub fn set_world_pos(&mut self, pos: Vec3)
pub fn set_world_pos(&mut self, pos: Vec3)
Sets the world-space position of this transform
Sourcepub fn set_local_pos(&mut self, pos: Vec3)
pub fn set_local_pos(&mut self, pos: Vec3)
Sets the local-space position of this transform
Sourcepub fn set_world_rot(&mut self, rot: Quat)
pub fn set_world_rot(&mut self, rot: Quat)
Sets the world-space rotation of this transform
Sourcepub fn set_local_rot(&mut self, rot: Quat)
pub fn set_local_rot(&mut self, rot: Quat)
Sets the local-space rotation of this transform
Sourcepub fn local_scale(&self) -> Vec3
pub fn local_scale(&self) -> Vec3
Gets the local-space scale of this transform
Sourcepub fn lossy_scale(&self) -> Vec3
pub fn lossy_scale(&self) -> Vec3
Gets the lossy world-space scale of this transform. Note: The world-space scale is lossy due to the math that is involved. It will be inaccurate
Sourcepub fn local_to_world(&self) -> Mat4
pub fn local_to_world(&self) -> Mat4
Gets the local-to-world matrix of this transform
Sourcepub fn world_to_local(&self) -> Mat4
pub fn world_to_local(&self) -> Mat4
Gets the world-to-local matrix of this transform
Trait Implementations§
Source§impl Component for Transform
impl Component for Transform
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Source§fn on_start(&mut self, _context: &mut Context<'_>)
fn on_start(&mut self, _context: &mut Context<'_>)
Source§fn on_destroy(&mut self, _context: &mut Context<'_>)
fn on_destroy(&mut self, _context: &mut Context<'_>)
Source§fn physics_update(&mut self, _context: &mut Context<'_>)
fn physics_update(&mut self, _context: &mut Context<'_>)
Source§fn post_physics_update(&mut self, _context: &mut Context<'_>)
fn post_physics_update(&mut self, _context: &mut Context<'_>)
Source§fn pre_update(&mut self, _context: &mut Context<'_>)
fn pre_update(&mut self, _context: &mut Context<'_>)
Source§fn update(&mut self, _context: &mut Context<'_>)
fn update(&mut self, _context: &mut Context<'_>)
Source§fn pre_render(&mut self, _context: &mut Context<'_>)
fn pre_render(&mut self, _context: &mut Context<'_>)
Source§fn on_message(&mut self, _context: &mut Context<'_>, _message: &Message)
fn on_message(&mut self, _context: &mut Context<'_>, _message: &Message)
Auto Trait Implementations§
impl Freeze for Transform
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnwindSafe for Transform
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> MessageCompatible for T
impl<T> MessageCompatible for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.