Constructor
new WorldManager(world, fps)
Creates world manager with default values and connection, scene, camera listeners.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
world |
World | ||
fps |
5 | network framerate, default 5 (send up to 5 events per second) |
- Source:
Classes
Members
authenticated
Set if session was authenticated CHECKME see if there's a better place for this
- Source:
avatarLoader
Avatar loader @type {AvatarLoader}
- Source:
connectionManager :ConnectionManager
Connection manager, initialized when entering a world for the first time
Type:
- Source:
debug
Enable debug output
- Source:
fps
Network frames per second, default 5
- Source:
instance
Current WorldManager instance @type {WorldManager}
- Source:
leftArmPos
Current left arm position
- Source:
leftArmRot
Current left arm rotation
- Source:
mediaStreams
This is set once we connect to streaming server @type {MediaStreams}
- Source:
meshLoader
Mesh loader @type {MeshLoader}
- Source:
myChangeListeners
Listeners notified after own avatar property (e.g. position) has changed and published
- Source:
oauth2providerId
used for reconnect
- Source:
pos
Current position
- Source:
remoteLogging
Mobile browsers don't have javascript console, and USB debugging is next to useless.
Enable to redirect all console output to the server log. Sure, it starts only after connection to the server is established.
- 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:
tokens
client tokens
- Source:
trackedMesh
In 3rd person view, we're not tracking and publishing position and orientation camera, but of this mesh
- Source:
trackRotation
Whether to track user rotation, default true.
- Source:
userHeight
User height in real world, default 1.8
- Source:
world
the world @type {World}
- Source:
Methods
(static) myId()
Returns VRSPACE.me if available, null otherwise
- Source:
addMyChangeListener()
Add a listener to own events
- Source:
addObject(obj)
Add an object to the scene - calls the appropriate loader method.
Parameters:
Name | Type | Description |
---|---|---|
obj |
VRObject |
- Source:
bBoxMax()
Utility method, calculates bounding box for an AssetContainer and returns maximum of x,y,z.
Works only for meshes already rendered
- Source:
boundingBox()
Utility method, calculates bounding box for an AssetContainer.
- Source:
Returns:
Vector3 bounding box
checkChange()
Check if a value has changed, and update change array if so.
- Source:
(async) enterAs(avatar) → {Promise.<Welcome>}
Enter the world as avatar.
Creates propererties by taking user name, height and avatar url from given Avatar,
then calls enter( properties ).
Parameters:
Name | Type | Description |
---|---|---|
avatar |
Avatar | User's avatar |
- Source:
Returns:
promise resolved after enter
- Type
- Promise.<Welcome>
(async) enterWith(avatarUrl, userName) → {Avatar}
Quick enter, with avatar url and optionally user name.
Parameters:
Name | Type | Description |
---|---|---|
avatarUrl |
string | URL to load avatar from |
userName |
string | login name of the user |
- Source:
Returns:
own Avatar instance
- Type
- Avatar
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:
loadScript()
Load a script, call it's constructor with the VRObject, then calls init(), and adds the listener.
See basic-script.js and web-portal.js.
- Source:
publishChanges(changes)
Publish changes to the server (if online) and local change listeners
Parameters:
Name | Type | Description |
---|---|---|
changes |
array of objects with field-value pairs |
- Source:
publishState()
Publish current values of all own properties. Used after reconnect.
- Source:
removeAll()
Remove all objects from the scene
- Source:
removeMyChangeListener()
Remove listener to own events
- Source:
removeObject(obj)
Remove an object: remove the mesh from the scene (scene listener), and dispose of everything.
Parameters:
Name | Type | Description |
---|---|---|
obj |
VRObject |
- Source:
sceneChanged(e)
Called when scene has changed (scene listener).
If an object was added, calls addObject.
If an object was removed, calls removeObject.
Any WorldListeners on the world are notified after changes are performed, by calling added and removed methods.
Parameters:
Name | Type | Description |
---|---|---|
e |
SceneEvent | 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,
and to myChangeListeners, by call to publishChanges().
- Source:
trackMesh()
Track a mesh, used in 3rd person view
- Source:
write()
Local user wrote something - send it over and notify local listener(s)
- Source: