pub struct Transform { /* private fields */ }
Expand description
Transform component.
Use to move and rotate entities (without physics).
Implementations
sourceimpl Transform
impl Transform
sourcepub fn position(&self) -> ValueAccessorReadWriteAnimate<Vec3>
pub fn position(&self) -> ValueAccessorReadWriteAnimate<Vec3>
Returns a ValueAccessor
for the local position of the entity.
Used to set/get/animate the position. Moves the entity to this position. If physics (non-kinematic) are enabled, it’s recommended to use forces instead of explicitly moving the entity.
sourcepub fn rotation(&self) -> ValueAccessorReadWriteAnimate<Quat>
pub fn rotation(&self) -> ValueAccessorReadWriteAnimate<Quat>
Returns a ValueAccessor
for the local rotation of the entity.
Used to set/get/animate the rotation (in quaternion format).
If physics (non-kinematic) are enabled, it’s recommended to use forces/torques instead of explicitly rotating the entity.
sourcepub fn scale(&self) -> ValueAccessorReadWriteAnimate<Vec3>
pub fn scale(&self) -> ValueAccessorReadWriteAnimate<Vec3>
Returns a ValueAccessor
for the local scale of the entity.
Used to set/get/animate the scale. Scale animation is not recommended for entities with physics enabled.
NOTE: scale values must be greater than (0, 0, 0)
sourcepub fn parent(&self) -> ValueAccessorReadWrite<Entity>
pub fn parent(&self) -> ValueAccessorReadWrite<Entity>
Sets/gets the parent of the entity in the transform hierarchy.
Does not work for dynamic physics. If you change an object to use dynamic physics, the parent will be removed. Works for kinematic physics objects though.
sourcepub fn world_position(&self) -> ValueAccessorReadWriteAnimate<Vec3>
pub fn world_position(&self) -> ValueAccessorReadWriteAnimate<Vec3>
Returns a ValueAccessor
for the world position of the entity.
Used to get the current world position.
sourcepub fn world_rotation(&self) -> ValueAccessorReadWriteAnimate<Quat>
pub fn world_rotation(&self) -> ValueAccessorReadWriteAnimate<Quat>
Returns a ValueAccessor
for the world rotation of the entity.
Used to get the current rotation (in quaternion format).
sourcepub fn world_scale(&self) -> ValueAccessorReadWriteAnimate<Vec3>
pub fn world_scale(&self) -> ValueAccessorReadWriteAnimate<Vec3>
Returns a ValueAccessor
for the world scale of the entity.
Used to get the scale. Will be the scale of the last frame.
sourcepub fn entity_to_parent(&self) -> Affine3A
pub fn entity_to_parent(&self) -> Affine3A
Returns the entity-to-parent transform as an Affine3A
.
sourcepub fn set_entity_to_parent(&self, entity_to_parent: &Affine3A)
pub fn set_entity_to_parent(&self, entity_to_parent: &Affine3A)
Set the entity-to-parent transform.
sourcepub fn parent_to_entity(&self) -> Affine3A
pub fn parent_to_entity(&self) -> Affine3A
Returns the parent-to-entity transform as an Affine3A
.
sourcepub fn set_parent_to_entity(&self, parent_to_entity: &Affine3A)
pub fn set_parent_to_entity(&self, parent_to_entity: &Affine3A)
Set the parent-to-entity transform from an Affine3A
.
sourcepub fn entity_to_world_decomposed(&self) -> Transform3
pub fn entity_to_world_decomposed(&self) -> Transform3
Returns the entity-to-world transform as a decomposed Transform3
(translation, rotation, scale).
sourcepub fn set_entity_to_world_decomposed(&self, entity_to_world: &Transform3)
pub fn set_entity_to_world_decomposed(&self, entity_to_world: &Transform3)
Sets the entity-to-world transform from a decomposed Transform3
(translation, rotation, scale).
sourcepub fn entity_to_world(&self) -> Affine3A
pub fn entity_to_world(&self) -> Affine3A
Returns the entity-to-world transform as an Affine3A
.
sourcepub fn set_entity_to_world(&self, entity_to_world: &Affine3A)
pub fn set_entity_to_world(&self, entity_to_world: &Affine3A)
Set the entity-to-world transform from an Affine3A
sourcepub fn world_to_entity(&self) -> Affine3A
pub fn world_to_entity(&self) -> Affine3A
Returns the world-to-entity transform as an Affine3A
.
sourcepub fn set_world_to_entity(&self, world_to_entity: &Affine3A)
pub fn set_world_to_entity(&self, world_to_entity: &Affine3A)
Set the world-to-entity transform.
Trait Implementations
sourceimpl ComponentTrait for Transform
impl ComponentTrait for Transform
sourcefn get_type() -> ComponentType
fn get_type() -> ComponentType
The type of the component, as a ComponentType
enum.
sourcefn from_entity(handle: Entity) -> Self
fn from_entity(handle: Entity) -> Self
Adopt an Entity
, wrap in a component struct.
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