Struct shiv_transform::Transform
source · Expand description
The local transform of an entity.
This is the transform relative to the [Parent
].
If there is no [Parent
], this it is relative to the origin.
Fields§
§translation: Vec3
§rotation: Quat
§scale: Vec3
Implementations§
source§impl Transform
impl Transform
pub const IDENTITY: Self = _
pub const fn from_xyz(x: f32, y: f32, z: f32) -> Self
pub const fn from_translation(translation: Vec3) -> Self
pub const fn from_rotation(rotation: Quat) -> Self
pub const fn from_scale(scale: Vec3) -> Self
pub const fn with_xyz(self, x: f32, y: f32, z: f32) -> Self
pub const fn with_translation(self, translation: Vec3) -> Self
pub const fn with_rotation(self, rotation: Quat) -> Self
pub const fn with_scale(self, scale: Vec3) -> Self
pub fn local_x(&self) -> Vec3
pub fn local_y(&self) -> Vec3
pub fn local_z(&self) -> Vec3
pub fn left(&self) -> Vec3
pub fn right(&self) -> Vec3
pub fn up(&self) -> Vec3
pub fn down(&self) -> Vec3
pub fn forward(&self) -> Vec3
pub fn back(&self) -> Vec3
pub fn translate(&mut self, translation: Vec3)
pub fn scale(&mut self, scale: Vec3)
pub fn rotate(&mut self, rotation: Quat)
pub fn rotate_x(&mut self, angle: f32)
pub fn rotate_y(&mut self, angle: f32)
pub fn rotate_z(&mut self, angle: f32)
pub fn look_at(&mut self, forward: Vec3, up: Vec3)
pub fn looking_at(self, forward: Vec3, up: Vec3) -> Self
sourcepub fn compute_matrix(&self) -> Mat4
pub fn compute_matrix(&self) -> Mat4
Computes the matrix representation of this transform.
Trait Implementations§
source§impl From<&Transform> for GlobalTransform
impl From<&Transform> for GlobalTransform
source§impl From<Transform> for GlobalTransform
impl From<Transform> for GlobalTransform
source§impl Mul<Transform> for GlobalTransform
impl Mul<Transform> for GlobalTransform
source§impl MulAssign<Transform> for Transform
impl MulAssign<Transform> for Transform
source§fn mul_assign(&mut self, rhs: Transform)
fn mul_assign(&mut self, rhs: Transform)
Performs the
*=
operation. Read moreimpl Copy for Transform
impl StructuralPartialEq for Transform
Auto Trait Implementations§
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> Bundle for Twhere
T: Component,
impl<T> Bundle for Twhere
T: Component,
type Iter = Once<*mut u8>
fn components(components: &mut Components) -> Vec<ComponentId, Global>
unsafe fn get_components(bundle: *mut T) -> <T as Bundle>::Iter
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
. Read more§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more§fn as_any(&self) -> &(dyn Any + 'static)
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. Read more§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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. Read more