Skip to main content

Class: TTransform

Defined in: math/transform.ts:7

A transform describes an option in 3D space

Constructors​

Constructor​

new TTransform(translation?, rotation?, scale?): TTransform

Defined in: math/transform.ts:12

Parameters​

translation?​

vec3 | undefined

rotation?​

quat | undefined

scale?​

vec3 | undefined

Returns​

TTransform

Properties​

rotation​

rotation: quat

Defined in: math/transform.ts:9


scale​

scale: vec3

Defined in: math/transform.ts:10


translation​

translation: vec3

Defined in: math/transform.ts:8

Methods​

add()​

add(b): TTransform

Defined in: math/transform.ts:57

Adds one transform to another

Parameters​

b​

TTransform

Returns​

TTransform

combined transform


getMatrix()​

getMatrix(): mat4

Defined in: math/transform.ts:41

Gets matrix and applies scale

Returns​

mat4


lookAt()​

lookAt(target): void

Defined in: math/transform.ts:124

Adjusts the rotation so it is looking towards a given position.

This method calculates the direction from the current position to the target position, then calculates the right and up vectors based on this direction. Finally, it creates a rotation quaternion from these vectors and sets the rotation to this quaternion.

Parameters​

target​

vec3

The target position as a vec3

Returns​

void


rotateX()​

rotateX(angle): void

Defined in: math/transform.ts:78

Rotate about the X axis

Parameters​

angle​

number

(in radians)

Returns​

void


rotateY()​

rotateY(angle): void

Defined in: math/transform.ts:87

Rotate about the Y axis

Parameters​

angle​

number

(in radians)

Returns​

void


rotateZ()​

rotateZ(angle): void

Defined in: math/transform.ts:96

Rotate about the Z axis

Parameters​

angle​

number

(in radians)

Returns​

void