rng(seed: number?) → void
Park–Miller rng. Returns roll(a?, b?): no args -> [0,1), (a, b) -> [a,b).
| arg | type | description |
|---|
| seed | number? | |
clamp(x: number, a: number, b: number) → number
| arg | type | description |
|---|
| x | number | |
| a | number | |
| b | number | |
lerp(a: number, b: number, t: number) → number
| arg | type | description |
|---|
| a | number | |
| b | number | |
| t | number | |
v(x: number, y: number, z: number) → void
Vectors are plain { x, y, z } maps.
| arg | type | description |
|---|
| x | number | |
| y | number | |
| z | number | |
vec(p: ?) → void
Accept { x=,y=,z= }, a transform proxy, or an array { x, y, z }.
scale(a: ?, s: number) → void
| arg | type | description |
|---|
| a | ? | |
| s | number | |
dot(a: ?, b: ?) → number return a
len(a: ?) → number return math
dist(a: ?, b: ?) → number return U
q(p: ?) → void
Quaternions are { x, y, z, w } maps. U.q also takes the { x, y, z, w } array form.
qEuler(px: number, py: number, pz: number) → void
Small rotation from pitch (x), yaw (y), roll (z) in radians, local axes.
| arg | type | description |
|---|
| px | number | |
| py | number | |
| pz | number | |
entityOf(target: ?) → void
An entity ref for a target, or nil. Takes a ref, an id string or a name.
| arg | type | description |
|---|
| target | ? | |
avatarKind(e: ?) → string
Whose body an entity is: "mine" (this peer's player), "other" (another
connected player's avatar) or nil (not a player's avatar).
remoteOwned(e: ?) → boolean
Whether a synced entity is owned by another peer, so this peer may not
write to it.
inGameplay( ) → boolean
Whether this peer is running gameplay: in play, with the scene in place
(false in edit mode and while a joiner's scene is still arriving).
editorCameraId( ) → string
isEditorCamera(e: ?) → boolean
Whether an entity is the editor's fly-camera. The kit never writes to it.
cameraEntity( ) → void
The gameplay camera this peer is drawn through, which the shake moves:
only in play, and never the editor's fly-camera.
cameraPos( ) → void
Where this peer is looking from: the gameplay camera, else whichever
camera is on screen (read only), else nil.
herePos( ) → void
Where this peer "is": its player's avatar, else its view, else the world
origin (a world with no player and no camera yet, a headless test run).
positionOf(target: ?) → void
Where a target is: an entity's position, a position as given, or this
peer's own spot (U.herePos) when the target is nil.
| arg | type | description |
|---|
| target | ? | |
rgba(c: ?, a: number) → string
| arg | type | description |
|---|
| c | ? | |
| a | number | |