Transform

Inherited: None

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

const Matrix4 &

localTransform () const

Transform *

parentTransform () const

Vector3

position () const

Quaternion

quaternion () const

Vector3

rotation () const

Vector3

scale () const

void

setDirty ()

void

setParent (Object * parent, int32_t position = -1, bool force = false)

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

const Matrix4 &

worldTransform () const

Static Methods

None

Methods Description

const Matrix4 & Transform::localTransform () const

Returns current transform matrix in local space.


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

Marks transform as dirty.


void Transform::setParent (Object * parent, int32_t position = -1, bool force = false)

Reimplements: Object::setParent(Object parent, int32_t *position, bool force).

Makes the Transform a child of parent at given position.

Note: Please ignore the force flag it will be provided by the default.


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.


const Matrix4 & Transform::worldTransform () const

Returns current transform matrix in world space.