Skip to main content

Editor.Transform

Class

Represents position, rotation, and scale in 3D space.

Index

Example

const t = new Editor.Transform(
new vec3(1, 2, 3),
new vec3(0, 45, 0),
new vec3(1, 1, 1)
);
console.log(`position: ${t.position}`);
console.log(`rotation: ${t.rotation}`);
console.log(`scale: ${t.scale}`);

t.position = new vec3(10, 20, 30);
t.rotation = new vec3(90, 0, 0);
t.scale = new vec3(2, 2, 2);
console.log(`Updated position: ${t.position}`);
console.log(`Updated rotation: ${t.rotation}`);
console.log(`Updated scale: ${t.scale}`);

Constructors

Constructor

new Transform(position, rotation, scale): Transform

Constructs a Transform with the given position, rotation, and scale vectors.

Parameters

ParameterType
positionvec3
rotationvec3
scalevec3

Returns

Transform

Properties

position

position: vec3

World-space position of the transform as a vec3.


rotation

rotation: vec3

Euler rotation of the transform as a vec3.


scale

scale: vec3

Scale of the transform as a vec3.