Skip to main content

Class: TransformManager

Reads and updates entity transforms.

Constructors​

Constructor​

new TransformManager(): TransformManager;

Returns​

TransformManager

Methods​

LookAt()​

static LookAt(
entity,
worldPosition,
worldUp?): Promise<void>;

Rotates an entity so it faces a world position.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to rotate.
worldPositionvec3The world position to face.
worldUp?vec3The upward direction to use. Defaults to [0, 1, 0].

Returns​

Promise<void>

A promise that resolves when the rotation has been changed.


SetParent()​

static SetParent(entity, parent?): Promise<void>;

Sets the parent of an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.
parent?numberThe parent Entity. If omitted, the entity will have no parent.

Returns​

Promise<void>

A promise that resolves when the parent has been changed.


GetParent()​

static GetParent(entity): Promise<undefined | number>;

Gets the parent of an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns​

Promise<undefined | number>

A promise that resolves to the parent Entity, or undefined if the entity has no parent.


SetWorldPosition()​

static SetWorldPosition(entity, pos): Promise<void>;

Sets the world position of an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.
posvec3The world position.

Returns​

Promise<void>

A promise that resolves when the world position has been changed.


SetLocalPosition()​

static SetLocalPosition(entity, pos): Promise<void>;

Sets the local position of an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.
posvec3The local position.

Returns​

Promise<void>

A promise that resolves when the local position has been changed.


GetWorldPosition()​

static GetWorldPosition(entity): Promise<vec3>;

Gets the world position of an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns​

Promise<vec3>

A promise that resolves to the world position.


GetLocalPosition()​

static GetLocalPosition(entity): Promise<vec3>;

Gets the local position of an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns​

Promise<vec3>

A promise that resolves to the local position.


SetWorldRotation()​

static SetWorldRotation(entity, rotation): Promise<void>;

Sets the world rotation of an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.
rotationquatThe world rotation quaternion in [x, y, z, w] order.

Returns​

Promise<void>

A promise that resolves when the world rotation has been changed.


SetLocalRotation()​

static SetLocalRotation(entity, rotation): Promise<void>;

Sets the local rotation of an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.
rotationquatThe local rotation quaternion in [x, y, z, w] order.

Returns​

Promise<void>

A promise that resolves when the local rotation has been changed.


GetWorldRotation()​

static GetWorldRotation(entity): Promise<quat>;

Gets the world rotation of an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns​

Promise<quat>

A promise that resolves to the world rotation quaternion.


GetLocalRotation()​

static GetLocalRotation(entity): Promise<quat>;

Gets the local rotation of an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns​

Promise<quat>

A promise that resolves to the local rotation quaternion.


SetLocalScale()​

static SetLocalScale(entity, scale): Promise<void>;

Sets the local scale of an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.
scalevec3The local scale.

Returns​

Promise<void>

A promise that resolves when the local scale has been changed.


GetLocalScale()​

static GetLocalScale(entity): Promise<vec3>;

Gets the local scale of an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns​

Promise<vec3>

A promise that resolves to the local scale.