Skip to content

Class: Transform

Transform is a component for storing positional information. The transform holds position, scale and angle values. Frequently used in rendering, collisions and physics.

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

+ new Transform(position?: Vector, scale?: Vector, angle?: number): Transform

Parameters:

Name Type Default value
position Vector -
scale Vector -
angle number 0

Returns: Transform

Inherited from: Component

Properties

angle

angle: number

Current transform angle in radians.


key

key: string

Inherited from: Component.key


position

position: Vector

Current transform position.


previous

previous: Vector

Previous position of the transform, used in interpolation.


scale

scale: Vector

Current transform scale.


KEY

Readonly Static KEY: transform= "transform"

Key of the transform component.


MESSAGE_ADD

Readonly Static MESSAGE_ADD: component_add= "component_add"

Inherited from: Component.MESSAGE_ADD


MESSAGE_REMOVE

Readonly Static MESSAGE_REMOVE: component_remove= "component_remove"

Inherited from: Component.MESSAGE_REMOVE

Methods

Free

Free(): void

Returns: void

Overrides: Component


InterpolatedMatrix4D

InterpolatedMatrix4D(alpha: number): Matrix4D

InterpolatedMatrix4D returns a 4x4 matrix representation of the transform that has applied its interpolation calculation between the previous frame's position and the current transform position. The interpolation is based on the alpha value provided, which is time since last game tick. Used in rendering and ensuring smooth motion between frames.

Parameters:

Name Type Description
alpha number time since last game tick

Returns: Matrix4D

Matrix of the interpolated transform.


Matrix3D

Matrix3D(): Matrix3D

Matrix3D returns a 3x3 matrix representation of the transform.

Returns: Matrix3D

Matrix of transforms


Matrix4D

Matrix4D(): Matrix4D

Matrix4D returns a 4x4 matrix representation of the transform.

Returns: Matrix4D

Matrix of transforms