Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / components / TransformComponent

Class: TransformComponent

Defined in: components/Transform.ts:50

Position, rotation, and scale of an entity in its parent's local space.

Remarks

Rotation is stored in radians (Euler XYZ). The editor inspector converts to/from degrees for display — do not store degrees in this component. Mutations should go through the setPosition / setRotation / setScale helpers so dependent systems pick up the change.

Extends

Constructors

Constructor

ts
new TransformComponent(data?): TransformComponent;

Defined in: components/Transform.ts:58

Parameters

ParameterType
dataTransformData

Returns

TransformComponent

Overrides

Component.constructor

Properties

PropertyTypeDescriptionDefined in
positionVec3Local position relative to the parent (or world if no parent).components/Transform.ts:52
rotationVec3Local rotation as Euler XYZ in radians.components/Transform.ts:54
scaleVec3Local scale factors per axis (1 = identity).components/Transform.ts:56

Methods

toPositionVector3()

ts
toPositionVector3(target?): Vector3;

Defined in: components/Transform.ts:84

Parameters

ParameterType
targetVector3

Returns

Vector3


toRotationEuler()

ts
toRotationEuler(target?, order?): Euler;

Defined in: components/Transform.ts:88

Parameters

ParameterTypeDefault value
targetEuler...
orderEulerOrder"XYZ"

Returns

Euler


toRotationQuaternion()

ts
toRotationQuaternion(target?, order?): Quaternion;

Defined in: components/Transform.ts:95

Parameters

ParameterTypeDefault value
targetQuaternion...
orderEulerOrder"XYZ"

Returns

Quaternion


toScaleVector3()

ts
toScaleVector3(target?): Vector3;

Defined in: components/Transform.ts:108

Parameters

ParameterType
targetVector3

Returns

Vector3


setPosition()

ts
setPosition(input): this;

Defined in: components/Transform.ts:112

Parameters

ParameterType
inputTransformInput

Returns

this


setScale()

ts
setScale(input): this;

Defined in: components/Transform.ts:120

Parameters

ParameterType
inputTransformInput

Returns

this


setRotation()

ts
setRotation(input, order?): this;

Defined in: components/Transform.ts:128

Parameters

ParameterTypeDefault value
inputTransformInputundefined
orderEulerOrder"XYZ"

Returns

this