Class: WorldManager

WorldManager(world, fps)

Manages world events: tracks local user events and sends them to the server, and tracks network events and applies them to local scene. Loads avatars of other users and maps network events to their avatars, including user video and audio streams.

Constructor

new WorldManager(world, fps)

Creates world manager with default values and connection, scene, camera listeners.
Parameters:
Name Type Description
world
fps network framerate, default 5 (send up to 5 events per second)
Source:

Classes

WorldManager

Members

avatarFactory

Avatar factory, default this.createAvatar
Source:

changeCallback

Optionally called after own avatar property has changed
Source:

customOptions

Custom avatar options, applied to avatars after loading. Currently video avatars only
Source:

debug

Enable debug output
Source:

defaultPosition

Default position applied after an avatar loads
Source:

defaultRotation

Default rotation applied after an avatar loads
Source:

leftArmPos

Current left arm position
Source:

leftArmRot

Current left arm rotation
Source:

mediaStreams

This is set once we connect to streaming server
Source:

mesh

Used in 3rd person view
Source:

pos

Current position
Source:

resolution

Movement resolution, default 1 cm/3.6 deg. Any movement less than this will be ignored.
Source:

rightArmPos

Current right arm position
Source:

rightArmRot

Current right arm rotation
Source:

rot

Current rotation
Source:

scene

the scene
Source:

trackRotation

Whether to track user rotation, default true.
Source:

world

the world
Source:

Methods

boundingBox()

Utility method, calculates bounding box for an AssetContainer.
Source:
Returns:
Vector3 bounding box

changeAvatar()

Apply remote changes to an avatar (VRObject listener)
Source:

changeObject()

Apply remote changes to an object.
Source:

checkChange()

Check if a value has changed, and update change array if so.
Source:

createAvatar()

Default video avatar factory method
Source:

(async) enter(properties)

Enter the world specified by world.name. If not already connected, first connect to world.serverUrl and set own properties, then start the session.
Parameters:
Name Type Description
properties own properties to set before starting the session
Source:
Returns:
Welcome promise

isChanged()

Return true if a value is ouside of given range.
Source:

isOnline()

Returns true if connected to the server and session is active
Source:

loadAvatar()

Load a 3D avatar, attach a listener to it
Source:

loadMesh()

Load an object and attach a listener.
Source:

loadStream()

Load a video avatar, attach a listener to it.
Source:

log()

Optionally log something
Source:

pubSub()

Publish and subscribe
Source:

removeMesh()

Remove a mesh from the scene (scene listener), and dispose of everything.
Source:

routeEvent(obj, field)

Called when applying changes other than rotation and translation: executes a method if such a method exists, passing it a current instance of associated VRObject.
Parameters:
Name Type Description
obj VRObject to apply change to
field member field to set or method to execute
Source:

sceneChanged(e)

Callend when scene has changed (scene listener). If an object was added, calls either loadAvatar, loadStream or loadMesh, as appropriate. If an object was removed, calls removeMesh.
Parameters:
Name Type Description
e SceneEvent containing the change
Source:

sendMy(obj)

Send own event.
Parameters:
Name Type Description
obj object containing changes to be sent, i.e. name-value pair(s).
Source:

setSessionStatus()

Called when connection to the server is established (connection listener)
Source:

trackCamera()

Tracks active camera
Source:

trackChanges()

Periodically executed, as specified by fps. Tracks changes to camera and XR controllers. Calls checkChange, and if anything has changed, changes are sent to server. Optionally, changeCallback is executed.
Source:

trackMesh()

Track a mesh, used in 3rd person view
Source: