Skip to main content
Version: 0.10.0

UeTransform

The base class for all objects that have a position, rotation, and scale in 3D space. It handles the hierarchical scene graph and matrix transformations.

Constructor​

new UeTransform(data = {})

Inherits from UeEventDispatcher

Data parameters​

KeyTypeDefaultDescription
positionvec3[0,0,0]Local position vector
rotationquat[0,0,0,1]Local rotation quaternion
scalevec3[1,1,1]Local scale vector
upvec3[0,0,-1]Local up direction
matrixAutoUpdatebooleantrueAutomatically update local matrix
matrixWorldAutoUpdatebooleantrueAutomatically update world matrix

Properties​

PropertyTypeDefaultDescription
positionvec3[0,0,0]Local position vector
rotationquat[0,0,0,1]Local rotation quaternion
scalevec3[1,1,1]Local scale vector
upvec3global.UE_DEFAULT_UPLocal up direction
matrixmat4Local transformation matrix
matrixWorldmat4World transformation matrix
versionnumber0Increments whenever the world matrix is updated. Used for performance tracking.
parentUeTransformundefinedParent transform
childrenarray[]Child transforms
matrixAutoUpdatebooleantrueIf true, recomputes local matrix every frame if needed
matrixWorldAutoUpdatebooleantrueIf true, recomputes world matrix every frame if needed
matrixWorldNeedsUpdatebooleanfalseFlag indicating world matrix needs recomputation

🧩 Methods​

Matrix Updates​

updateMatrix()

Recomputes the local matrix from position, rotation, and scale.

updateMatrixWorld(force = false)

Updates the world matrix of this object and its children.

updateWorldMatrix(updateParents = false, updateChildren = false)

Updates world matrices with optional parent or child propagation.

forceUpdate(startFromRoot = false)

Forces an update of the local and world matrices on this object and its children. Also static objects will be updated. If startFromRoot is true, the update starts from the absolute root object.

Translation​

setPosition(x, y, z)

Sets the local position.

translateX(value)
translateY(value)
translateZ(value)

Translates along the local X, Y, or Z axis.

translateOnAxis(axis, distance)

Translates the object by distance along a specific axis in local space.

translate(x, y, z)

Translates the object in local space by the given amounts.

Rotation​

lookAt(x, y, z)
lookAtVec(target)

Rotates the object to face a target position or vector.

setRotation(x, y, z)

Sets rotation from Euler angles (in degrees).

setRotationFromMatrix(mat)

Sets rotation from a rotation matrix.

setRotationFromQuaternion(quat)

Copies a quaternion into the rotation property.

rotate(x, y, z)

Applies an Euler rotation increment.

rotateX(angle)
rotateY(angle)
rotateZ(angle)

Rotates around the local X, Y, or Z axis by the given angle (in degrees).

rotateOnAxis(axis, angle)

Rotates around a specific axis in local space.

rotateOnWorldAxis(axis, angle)

Rotates around a specific axis in world space.

Scale​

setScale(x, y, z)

Sets the local scale.

scaleX(value)
scaleY(value)
scaleZ(value)

Increments the scale on the X, Y, or Z axis.

Transformation​

applyMatrix4(mat4)

Applies a matrix transformation to the object.

applyQuaternion(quat)

Applies a quaternion rotation to the object.

getWorldPosition(target = undefined)

Returns the world position of the object. If target is provided, the result is stored in it; otherwise, a new array is returned.

getWorldQuaternion(target = undefined)

Returns the world rotation quaternion. If target is provided, the result is stored in it; otherwise, a new array is returned.

getWorldScale(target = undefined)

Returns the world scale. If target is provided, the result is stored in it; otherwise, a new array is returned.

getWorldDirection(target = undefined)

Returns a vector representing the world direction the object is facing (based on the up property). If target is provided, the result is stored in it; otherwise, a new array is returned.

localToWorld(vector)

Converts a vector from local space to world space.

worldToLocal(vector)

Converts a vector from world space to local space.