Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

LiveObject

LiveObject<T> = T & object

An object a trait keeps that is a handle with its own state and methods rather than data, such as an AnimationMixer or a pathfinder: a read hands it as it is, as it hands an Object3D, so it passes where its class is asked for and its methods run. Mark the field’s type: mixer: (): LiveObject<AnimationMixer> | null => null. The mark is an optional key of the type alone, so the plain object passes where a LiveObject is asked for. The fields around it still read read-only.

A live object is no data the room decides: a trait the stream carries refuses one by type, so keep it in a Reach.Local or a Reach.Authority trait. A change made through its methods tells no watcher, such as useTrait. Mark only a handle: a marked Vector3 reads writable again.

Name Type
[liveObjectBrand]? true
Type Parameter
T extends object