Struct ark_api::world::Transform

source ·
pub struct Transform { /* private fields */ }
Expand description

Transform component.

Use to move and rotate entities (without physics).

Implementations§

source§

impl Transform

source

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.

source

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.

source

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

source

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.

source

pub fn world_position(&self) -> ValueAccessorReadWriteAnimate<Vec3>

Returns a ValueAccessor for the world position of the entity.

Used to get the current world position.

source

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).

source

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.

source

pub fn entity_to_parent(&self) -> Conformal3

Returns the entity-to-parent transform as a Conformal3.

source

pub fn set_entity_to_parent(&self, entity_to_parent: &Conformal3)

Set the entity-to-parent transform.

source

pub fn parent_to_entity(&self) -> Conformal3

Returns the parent-to-entity transform as a Conformal3.

source

pub fn set_parent_to_entity(&self, parent_to_entity: &Conformal3)

Set the parent-to-entity transform from a Conformal3.

source

pub fn entity_to_world(&self) -> Conformal3

Returns the entity-to-world transform as a decomposed Conformal3 (translation, rotation, uniform scale).

source

pub fn set_entity_to_world(&self, entity_to_world: &Conformal3)

Sets the entity-to-world transform from a Conformal3 (translation, rotation, uniform scale).

source

pub fn world_to_entity(&self) -> Conformal3

Returns the world-to-entity transform as an Conformal3.

source

pub fn set_world_to_entity(&self, world_to_entity: &Conformal3)

Set the world-to-entity transform.

source§

impl Transform

source

pub fn children(&self) -> Vec<Entity>

Retrieves all the direct transform children of this entity

source

pub fn descendants(&self) -> Vec<Entity>

Retrieves all the transform descendants of this entity.

Trait Implementations§

source§

impl ComponentTrait for Transform

source§

fn get_type() -> ComponentType

The type of the component, as a ComponentType enum.
source§

fn from_entity(handle: Entity) -> Self

Adopt an Entity, wrap in a component struct.
source§

fn try_from_entity(handle: Entity) -> Option<Self>

Try to adopt an Entity, wrapping it in a component struct.
source§

fn entity(&self) -> Entity

Get the entity that the component belongs to.
source§

impl Debug for Transform

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.