Repository navigation
API Class Transform
Defined in: src/engine/core/Transform.ts:23
A node's position, rotation and scale (ADR 0008, 0010, 0163).
position, rotation (a quaternion) and scale are local (relative to the parent), as the fields
of Unity ECS's LocalTransform, and are live views (ADR 0019): transform.position.x += 1 moves the
node. Use .clone() to keep a snapshot. Turn with rotate, rotateX/Y/Z rather than by editing
Euler angles. World space: localToWorld (as Unity ECS's LocalToWorld), worldPosition,
worldRotation, worldRotation2D and worldScale.
Transform data lives in the World's typed arrays; this class is a facade over it.
get eulerAngles(): Vector3;Defined in: src/engine/core/Transform.ts:72
Local rotation as Euler angles in radians, as Unity's localEulerAngles (but radians, ADR 0164): order
ZXY (roll, then pitch, then yaw), each read back in [0, 2π). Returns a copy. Reading, changing and writing
back works for yaw (y) all the way round but not for pitch (x) past ±π/2, which reads back flipped; turn
with rotate, rotateX/Y/Z instead.
set eulerAngles(v): void;Defined in: src/engine/core/Transform.ts:73
void
get localToWorld(): LocalToWorld;Defined in: src/engine/core/Transform.ts:174
A snapshot of the node's local-to-world matrix (as Unity ECS's LocalToWorld): value, position,
rotation, right, up, forward, and transformPoint / inverseTransformPoint to convert
points between this node's space and world space.
get node(): GameObject;Defined in: src/engine/core/Transform.ts:46
get position(): Vector3;Defined in: src/engine/core/Transform.ts:51
Local position (live view).
set position(v): void;Defined in: src/engine/core/Transform.ts:52
void
get position2D(): Vector2;Defined in: src/engine/core/Transform.ts:55
Local x/y position (live view over the same storage as position).
set position2D(v): void;Defined in: src/engine/core/Transform.ts:56
Vector2 | readonly [number, number]
void
get rotation(): Quaternion;Defined in: src/engine/core/Transform.ts:59
Local rotation (live view).
set rotation(q): void;Defined in: src/engine/core/Transform.ts:60
void
get rotation2D(): number;Defined in: src/engine/core/Transform.ts:95
Local rotation around Z in radians (-π..π); positive is counter-clockwise on screen.
number
set rotation2D(angle): void;Defined in: src/engine/core/Transform.ts:96
number
void
get scale(): Vector3;Defined in: src/engine/core/Transform.ts:63
Local scale (live view).
set scale(v): void;Defined in: src/engine/core/Transform.ts:64
void
get worldPosition(): Vector3;Defined in: src/engine/core/Transform.ts:99
World-space position. Returns a copy; assigning moves the node.
set worldPosition(v): void;Defined in: src/engine/core/Transform.ts:103
void
get worldRotation(): Quaternion;Defined in: src/engine/core/Transform.ts:136
World-space rotation. Returns a copy; assigning turns the node.
set worldRotation(q): void;Defined in: src/engine/core/Transform.ts:140
void
get worldRotation2D(): number;Defined in: src/engine/core/Transform.ts:119
World-space rotation around Z in radians (2D), as the node's 2D frame reads it (ADR 0301): a mirrored node carries its mirror on x, so a node scaled (-1, 1) and turned θ reads θ (not θ + π). Assigning turns the node and keeps its mirroring.
number
set worldRotation2D(angle): void;Defined in: src/engine/core/Transform.ts:122
number
void
get worldScale(): Vector3;Defined in: src/engine/core/Transform.ts:153
World-space scale (lossy, from matrix column lengths).
rotate(rotation, space?): void;Defined in: src/engine/core/Transform.ts:82
Turn by rotation, about the parent's axes (rotation = q · rotation, default) or the node's own
("self": rotation = rotation · q). Named after Unity ECS's LocalTransform.Rotate.
"parent" | "self" = "parent"
void
rotate2D(angle): void;Defined in: src/engine/core/Transform.ts:165
Rotate around Z by angle radians.
number
void
rotateX(angle, space?): void;Defined in: src/engine/core/Transform.ts:88
Turn angle radians about the X axis (the parent's, or the node's own with "self"); positive pitches down.
number
"parent" | "self" = "parent"
void
rotateY(angle, space?): void;Defined in: src/engine/core/Transform.ts:90
Turn angle radians about the Y axis (the parent's, or the node's own with "self"); positive yaws right.
number
"parent" | "self" = "parent"
void
rotateZ(angle, space?): void;Defined in: src/engine/core/Transform.ts:92
Turn angle radians about the Z axis (the parent's, or the node's own with "self").
number
"parent" | "self" = "parent"
void
translate(delta, space?): void;Defined in: src/engine/core/Transform.ts:159
Move by delta, in local (parent) space by default or world space.
"local" | "world" = "local"
void
This wiki is generated from docs/wiki/ and the myco module's source on every push to master. Change pages there in a pull request: edits made here are not kept.
Basics
Gameplay
Rendering
Audio
- Playing sound
- Why is there no sound?
- Playlists
- Interactive music
- Sound generators
- Spatial audio
- Audio mixer
- Live mixing
- Loudness
- Audio profiler
- Audio takes
Reference