Struct moon_engine::transform::Transform
source · [−]pub struct Transform {
pub position: Vec3,
pub rotation: Vec3,
pub scale: Vec3,
/* private fields */
}
Expand description
Fields
position: Vec3
Position component of the Transform
.
rotation: Vec3
Rotation component of the Transform
.
scale: Vec3
Scale component of the Transform
.
Implementations
sourceimpl Transform
impl Transform
sourcepub fn new_with_position(position: Vec3) -> Self
pub fn new_with_position(position: Vec3) -> Self
Create a new Transform
with an initial position.
sourcepub fn matrix_slice(&mut self) -> &[f32]
pub fn matrix_slice(&mut self) -> &[f32]
sourcepub fn set_position(&mut self, position: Vec3)
pub fn set_position(&mut self, position: Vec3)
Set the Transform
’s position and calculate its matrix.
sourcepub fn set_rotation(&mut self, rotation: f32)
pub fn set_rotation(&mut self, rotation: f32)
Set the Transform
’s rotation and calculate its matrix.
sourcepub fn get_position(&self) -> &[f32]
pub fn get_position(&self) -> &[f32]
Get the position as a slice.
sourcepub fn get_rotation(&self) -> f32
pub fn get_rotation(&self) -> f32
Get the rotation as an f32.
Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
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
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.