ObjectTransform

Transformation component for SceneObjects.

Constructor

new L3D.ObjectTransform()

Properties

customParentMatrix Matrix4

If not null, this matrix will be for the parent transformation matrix instead of calculating it.

eulerAngles Vector3

The euler angle orientation of the transform.

matrix Matrix4

The local space matrix of the transform. If a customMatrix has been set, it will be returned.

parentTransform ObjectTransform

Parent of this ObjectTransform in its transformation hierarchy.

parentWorldMatrix Matrix4

The worl matrix of the parent transform.

position Vector3

The local space position of the transform.

rotation Quaternion

The quaternion orientation of the transform.

rotationOrder number

The order to apply euler angle rotations.

scale Vector3

The local space scale of the transform.

worldMatrix Matrix4

The world space matrix of the transform.

worldPosition Vector3

The world space position of the transform.

Methods

configure(o)

Configure the transform with the given settings.

Parameters
o Object

getWorldForward(out)Vector3

Get the world space forward vector of the transform.

Parameters
out Vector3

Optional storage for the output.

Returns
Vector3

getWorldMatrix(out)Matrix4

Get the local to world space matrix of the transform.

Parameters
out Matrix4

Optional storage for the output.

Returns
Matrix4

getWorldPosition(out)Vector3

Get the world space position of the transform.

Parameters
out Vector3

Optional storage for the output.

Returns
Vector3

getWorldRight(out)Vector3

Get the world space right vector of the transform.

Parameters
out Vector3

Optional storage for the output.

Returns
Vector3

getWorldRotation(out)Quaternion

Get the world space orientation of the transform.

Parameters
out Quaternion

Optional storage for the output.

Returns
Quaternion

getWorldToLocalMatrix(out)Matrix4

Get the world to local space matrix for the transform.

Parameters
out Matrix4

Optional storage for the output.

Returns
Matrix4

getWorldUp(out)Vector3

Get the world space up vector of the transform.

Parameters
out Vector3

Optional storage for the output.

Returns
Vector3

lookAt(position, target, up, worldSpace)

Orients the transform to look from one position to another.

Parameters
position Vector3
target Vector3
up Vector3
worldSpace bool false

If true, position and target are in world space.

onDestroy()

Called when the object is deleted.

reset()

Reset the transform to its default state.

rotate(axis, angle, worldSpace)

Rotate the transform by the angle around an axis.

Parameters
axis Vector3
angle number

The angle to rotate, in degrees

worldSpace bool

If the axis is in world space or local space

rotateQuaternion(q)

Rotate the transform by the given quaternion.

Parameters
q Quaternion

serialize()

Serialize the transform to a JSON structure.

setDirty()

Dirty the local and world matrices so they will be recomputed the next time they are requested.

setLocalDirty()

Marks the local matrix as dirty. This will also mark all of its dependents world matrices as dirty.

setWorldDirty(onlySelf)

Marks the world matrix as dirty. This will also mark all of its dependents world matrices as dirty, if onlySelf is not true.

Parameters
onlySelf bool

update(force)

Recompute the local and world matrices of the transform, if necessary.

Parameters
force bool

worldVectorToLocal(v, out)Vector3

Transform the world space vector to the transforms local space.

Parameters
v Vector3

The vector to transform.

out Vector3

Optional storage for the output.

Returns
Vector3