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<f32>
pub fn scale(&self) -> ValueAccessorReadWriteAnimate<f32>
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
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<f32>
pub fn world_scale(&self) -> ValueAccessorReadWriteAnimate<f32>
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) -> Conformal3
pub fn entity_to_parent(&self) -> Conformal3
Returns the entity-to-parent transform as a Conformal3.
sourcepub fn set_entity_to_parent(&self, entity_to_parent: &Conformal3)
pub fn set_entity_to_parent(&self, entity_to_parent: &Conformal3)
Set the entity-to-parent transform.
sourcepub fn parent_to_entity(&self) -> Conformal3
pub fn parent_to_entity(&self) -> Conformal3
Returns the parent-to-entity transform as a Conformal3.
sourcepub fn set_parent_to_entity(&self, parent_to_entity: &Conformal3)
pub fn set_parent_to_entity(&self, parent_to_entity: &Conformal3)
Set the parent-to-entity transform from a Conformal3.
sourcepub fn entity_to_world(&self) -> Conformal3
pub fn entity_to_world(&self) -> Conformal3
Returns the entity-to-world transform as a decomposed Conformal3 (translation, rotation, uniform scale).
sourcepub fn set_entity_to_world(&self, entity_to_world: &Conformal3)
pub fn set_entity_to_world(&self, entity_to_world: &Conformal3)
Sets the entity-to-world transform from a Conformal3 (translation, rotation, uniform scale).
sourcepub fn world_to_entity(&self) -> Conformal3
pub fn world_to_entity(&self) -> Conformal3
Returns the world-to-entity transform as an Conformal3.
sourcepub fn set_world_to_entity(&self, world_to_entity: &Conformal3)
pub fn set_world_to_entity(&self, world_to_entity: &Conformal3)
Set the world-to-entity transform.
Trait Implementations
sourceimpl ComponentTrait for Transform
impl ComponentTrait for Transform
sourcefn get_type() -> ComponentType
fn get_type() -> ComponentType
ComponentType enum.sourcefn from_entity(handle: Entity) -> Self
fn from_entity(handle: Entity) -> Self
Entity, wrap in a component struct.