The Transform component defines an entity's position, scale and rotation in the game world.
It can be nested under a parent transform to create hierarchical relationships, where child transforms inherit and combine with their parent's transformations.
The component provides both local and world-space values, and allows selectively ignoring parent transformations.

const transform = new Transform({
position: new Vector2(100, 100),
scale: new Vector2(2, 2),
rotation: Math.PI / 4
});

Constructors

Properties

ignoreParentPosition: boolean = false

If TRUE, the parent position will be ignored

ignoreParentRotation: boolean = false

If TRUE, the parent rotation will be ignored

ignoreParentScale: boolean = false

If TRUE, the parent scale will be ignored

localPosition: Vector2 = ...

READONLY: The real position in the simulated world. It has the same value as position property if there is no parent

localRotation: number = 0

READONLY: The real rotation in the simulated world. It has the same value as rotation property if there is no parent

localScale: Vector2 = ...

READONLY: The real scale in the simulated world. It has the same value as scale property if there is no parent

position: Vector2 = ...

Position relative to the zero point of the simulated world, or relative to the parent if it has one

rotation: number = 0

Rotation expressed in radians

scale: Vector2 = ...

Scale on x-axis and y-axis