Skip to content

World ​

world is a global singleton.

Objects ​

js

// Use these at runtime to add/remove objects

// World will now call object.update() if it has an update function,
// and will add it to .raycastables if it has interaction events
world.add(object: THREE.Object3D, addToScene: boolean = true)

// Fully remove an interactable object
world.remove(object)
object.removeFromParent()


// list of objects that .update() each frame
world.objects -> Array of Objects

// list of objects which are raycasted each frame
world.raycastables -> Array of Objects

// make an object grabbable at runtime
world.addGrabbable(object)

Avatars ​

js
world.avatars -> Dict of Objects
world.addAvatar(avatarRoot)
world.avatar -> Your avatar

Other ​

js

world.username -> 'yourUserName' | null
world.scene -> THREE.Scene
world.renderer -> THREE.WebGLRenderer (WebGPU coming when XR is supported)
world.physics -> Physics global, see physics docs
world.storage -> Storage global, see storage docs
world.camera - > THREE.PerspectiveCamera, the player camera
world.animationMixer -> THREE.AnimationMixer, the main animation mixer

world.XR -> Boolean, whether we are in XR or not
world.startXR()
world.stopXR()

world.stats ->
{
    triangles: number,
    FPS: number,
    // if enabled this will log the GPU frame time in ms.
    // This uses the EXT_disjoint_timer_query_webgl2 extension
    // which is not available on all GPUs
    dev: Boolean
}