Transform

Inherited: Component

Description

Every Actor in a Scene has a Transform. It’s used to store and manipulate the position, rotation and scale of the object. Every Transform can have a parent, which allows you to apply position, rotation and scale hierarchically.

Public Methods

bool

dirty () const

Matrix4

localTransform () const

Transform *

parentTransform () const

Vector3

position () const

Quaternion

quaternion () const

Vector3

rotation () const

Vector3

scale () const

void

setDirty (bool dirty)

void

setParentTransform (Transform * parent, bool force = false)

void

setPosition (const Vector3 position)

void

setQuaternion (const Quaternion quaternion)

void

setRotation (const Vector3 angles)

void

setScale (const Vector3 scale)

Vector3

worldPosition () const

Quaternion

worldQuaternion () const

Vector3

worldRotation () const

Vector3

worldScale () const

Matrix4

worldTransform () const

Static Methods

None

Methods Description

bool Transform::dirty () const

Returns true if transform has changed; otherwise returns false.

See also setDirty().


Matrix4 Transform::localTransform () const

Returns current transform matrix in local space.


:ref:`Transform<api_Transform>`* Transform::parentTransform () const

Returns parent of the transform.

See also setParentTransform().


Vector3 Transform::position () const

Returns current position of the Transform in local space.

See also setPosition().


Quaternion Transform::quaternion () const

Returns current rotation of the Transform in local space as Quaternion.

See also setQuaternion().


Vector3 Transform::rotation () const

Returns current rotation of the Transform in local space as Euler angles in degrees.

See also setRotation().


Vector3 Transform::scale () const

Returns current scale of the Transform in local space.

See also setScale().


void Transform::setDirty (bool dirty)

Marks transform as dirty.

See also *dirty*().


void Transform::setParentTransform (Transform * parent, bool force = false)

Changing the parent will modify the parent-relative position, scale and rotation but keep the world space position, rotation and scale the same. In case of force flag provided as true, no recalculations of transform happen.

See also *parent*Transform().


void Transform::setPosition (Vector3 position)

Changes position of the Transform in local space.

See also *position*().


void Transform::setQuaternion (Quaternion quaternion)

Changes the rotation quaternion of the Transform in local space by provided Quaternion.

See also *quaternion*().


void Transform::setRotation (Vector3 angles)

Changes the rotation of the Transform in local space by provided Euler angles in degrees.

See also rotation().


void Transform::setScale (Vector3 scale)

Changes the scale of the Transform in local space.

See also *scale*().


Vector3 Transform::worldPosition () const

Returns current position of the transform in world space.


Quaternion Transform::worldQuaternion () const

Returns current rotation of the transform in world space as Quaternion.


Vector3 Transform::worldRotation () const

Returns current rotation of the transform in world space as Euler angles in degrees.


Vector3 Transform::worldScale () const

Returns current scale of the transform in world space.


Matrix4 Transform::worldTransform () const

Returns current transform matrix in world space.