Namespace

SDK3DVerse

SDK3DVerse. Handles the starting and joining of sessions.

Members

object

# readonly cameraControllerType

Get the available camera controller types. Intended to be used with SDK3DVerse.setViewports

Properties:
Name Type Default Description
none int -1
orbit int 1

Orbital camera

editor int 4

3D world editor camera controller. It's the default camera controller

Example
SDK3DVerse.cameraControllerType.editor
object

# readonly PhysicsQueryFilterFlag

Readonly object which contains the bit flags used to apply a filter on physics bodies hit by physicsRaycast.

A physics body encountered by a ray can be either considered as:

  • a block (stopping the ray when the ray hits it), or
  • a touch (non-blocking, i.e. allowing the ray to pass through it)

The flags specify which physics body types block the ray, and whether the non-blocking body types should be returned as touches in the PhysicsRaycastResult. There are two physics body types considered:

  • static (for static bodies), and
  • dynamic (for rigid bodies and kinematic rigid bodies)
Properties:
Name Type Default Description
dynamic_block number 2

Dynamic bodies are blocking

static_block number 4

Static bodies are blocking

distance_agnostic_block number 1

This is a performance hint. Specifies there is no need to look for the closest block - any blocking body along the ray's path is returned as block. Touches aren't recorded

record_touches number 8

Ray records non-blocking bodies on its path as touches. Ignored if specified with distance_agnostic_block

See:
Example
SDK3DVerse.PhysicsQueryFilterFlag.dynamic_block

Methods

# close()

Close the current connection to the session

# async connectToEditor(editorURLopt)

Connect to the editor to offer edition capabilities

Parameters:
Name Type Attributes Description
editorURL string <optional>

Default to 'wss://api.3dverse.com/editor-backend/'

# disableInputs()

Disable input events on canvas (mouse and keyboard).

# enableInputs()

Enable input events on the canvas (mouse and keyboard).

# async findSessions(params) → {Promise.<Array.<GetSceneSessions_Session>>}

This function returns the list of sessions already open for a given sceneUUID.

Parameters:
Name Type Description
params object
userToken string

Your 3dverse user token or public token.

sceneUUID string

The ID for the scene you wish to open.

Promise.<Array.<GetSceneSessions_Session>>

# getClientUUID() → {string}

Get current clientUUID

clientUUID - The client unique identifier.

string

# getKey(key) → {object}

Get the down state of the specified keyboard key

Parameters:
Name Type Description
key string

character key

value.down - True if key is pressed, false otherwise.

object

# getVersion() → {string}

Get the SDK version.

version

string

# async installExtension(extensionClass, parameters) → {SDK3DVerse_ExtensionInterface}

Installs one or more of the available 3dverse sdk extensions

Parameters:
Name Type Description
extensionClass SDK3DVerse_ExtensionInterface

SDK3DVerse_Gizmos_Ext / SDK3DVerse_LabelDisplay_Ext / SDK3DVerse_ClientDisplay_Ext

parameters object

Extensions parameters, see documentation for each extension.

instanciated extension

SDK3DVerse_ExtensionInterface

# isConnected() → {Boolean}

Check if the client is actually connected or not

Connected state

Boolean

# async joinOrStartSession(params)

Join an existing 3dverse session if one exists for a given scene (with optional constraints), or else create one, and begin streaming to a canvas element in your app.

Parameters:
Name Type Attributes Default Description
params object
sceneUUID string

The ID for the scene you wish to open.

userToken string

Your 3dverse user token or public token.

canvas HTMLCanvasElement

The canvas element to display the stream, whose size will be set by its parent.

constraints SessionConstraints <optional>

Constraints for the session that 3dverse might try to join.

isTransient boolean <optional>
false

Set to true if you want all changes made to be transient.

connectToEditor boolean <optional>
true

Set to true to enable making transient or persistent edits to the scene graph.

startSimulation 'no' | 'yes' | 'on-assets-loaded' <optional>
'no'

'yes' to start simulation after connecting to new session, 'on-assets-loaded' to wait for assets to load first.

createDefaultCamera boolean <optional>
true

Create default camera.

viewportProperties object <optional>

Additional viewport settings (such as the controller to use). Not used if createDefaultCamera is false.

maxDimension number <optional>
1920

Limit the rendered resolution to a maximum dimension.

onFindingSession function <optional>

Callback to know when we've begun looking for a session to join (to give more detailed loading feedback to users). This callback will be triggered immediately, but can be triggered again (along with the other callbacks) if a session connection fails and we have to restart.

onStartingStreamer function <optional>

Callback to know when the streamer connection has begun (to give more detailed loading feedback to users).

onConnectingToEditor function <optional>

Callback to know when the editor connection has started (to give more detailed loading feedback to users).

onLoadingAssets function <optional>

Callback to know when we're connected and now waiting for assets to finish loading (to give more detailed loading feedback to users). Will only be called if startSimulation is 'on-assets-loaded', and assets are not yet loaded after editor connection.

defaultCameraSpeed string | float <optional>
'auto'

The speed of the camera controller to set after the session is joined. The 'auto' value uses the scene aabb to determine the most suitable speed, or it can be set to a float value in meters per second.

# async joinSession(params)

Join an existing 3dverse session and begin streaming to a canvas element in your app.

Parameters:
Name Type Attributes Default Description
params object
sessionId string

The ID for the session you wish to join.

userToken string

Your 3dverse user token or public token.

canvas HTMLCanvasElement

The canvas element to display the stream, whose size will be set by its parent.

isTransient boolean <optional>
false

Set to true if you want all changes made to be transient.

connectToEditor boolean <optional>
true

Set to true to enable making transient or persistent edits to the scene graph.

createDefaultCamera boolean <optional>
true

Create default camera.

viewportProperties object <optional>

Additional viewport settings (such as the controller to use). Not used if createDefaultCamera is false.

maxDimension number <optional>
1920

Limit the rendered resolution to a maximum dimension.

onStartingStreamer function <optional>

Callback to know when the streamer connection has begun (to give more detailed loading feedback to users).

onConnectingToEditor function <optional>

Callback to know when the editor connection has started (to give more detailed loading feedback to users).

defaultCameraSpeed string | float <optional>
'auto'

The speed of the camera controller to set after the session is joined. The 'auto' value uses the scene aabb to determine the most suitable speed, or it can be set to a float value in meters per second.

# async onConnected() → {Promise}

Return a promise, which will be resolved once the loading ended.

Promise object

Promise

# async onEditorConnected() → {Promise}

Return a promise, which will be resolved once the editor will be connected.

Promise object

Promise

# setApiVersion(apiVersion)

Set the current web API version

Parameters:
Name Type Description
apiVersion string

API version to use

# setInactivityCallback(callback)

Set a callback that is called when the client is inactive.

Parameters:
Name Type Description
callback function

# setInputRelayFrequency(inputRelayFrequency)

Set frequency at which inputs (keyboards, gamepads, touchscreen...) are relayed to the server

Parameters:
Name Type Description
inputRelayFrequency number

in milliseconds

# setMainCamera(cameraEntity)

Setup a single viewport with an existing camera entity

Parameters:
Name Type Description
cameraEntity Entity

Entity that contains a camera component

# setResolution(width, height, streamingScaleopt)

Set real time rendering display area resolution

Parameters:
Name Type Attributes Description
width number

Width in pixels

height number

Height in pixels

streamingScale number <optional>

Scale applied on streaming resolution

# setupDisplay(canvasElement)

Setup display canvas

Parameters:
Name Type Description
canvasElement domElement

Canvas element used to display real time rendering

# setUpperAlignment(value)

Set to true to force the canvas to align on the next largest dimension during a setResolution. In that case a container that will center the canvas and hide the overflow is suggested. For example :

.canvas-container
{
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}
Parameters:
Name Type Description
value bool

# setViewports(viewports)

Set viewports

Parameters:
Name Type Description
viewports Array.<viewport_info>

Array of viewport_info objects

# async startSession(params)

Create a new 3dverse session and begin streaming to a canvas element in your app.

Parameters:
Name Type Attributes Default Description
params object
sceneUUID string

The ID for the scene you wish to open.

userToken string

Your 3dverse user token or public token.

canvas HTMLCanvasElement

The canvas element to display the stream, whose size will be set by its parent.

isTransient boolean <optional>
false

Set to true if you want all changes made to be transient.

connectToEditor boolean <optional>
true

Set to true to enable making transient or persistent edits to the scene graph.

startSimulation 'no' | 'yes' | 'on-assets-loaded' <optional>
'no'

'yes' to start simulation after connecting, 'on-assets-loaded' to wait for assets to load first.

createDefaultCamera boolean <optional>
true

Create default camera.

viewportProperties object <optional>

Additional viewport settings (such as the controller to use). Not used if createDefaultCamera is false.

maxDimension number <optional>
1920

Limit the rendered resolution to a maximum dimension.

onStartingStreamer function <optional>

Callback to know when the streamer connection has begun (to give more detailed loading feedback to users).

onConnectingToEditor function <optional>

Callback to know when the editor connection has started (to give more detailed loading feedback to users).

onLoadingAssets function <optional>

Callback to know when we're connected and now waiting for assets to finish loading (to give more detailed loading feedback to users). Will only be called if startSimulation is 'on-assets-loaded', and assets are not yet loaded after editor connection.

defaultCameraSpeed string | float <optional>
'auto'

The speed of the camera controller to set after the session is joined. The 'auto' value uses the scene aabb to determine the most suitable speed, or it can be set to a float value in meters per second.

# startStreamer(connectionInfo, hardwareDecodingopt, hevcSupportopt)

Start the streaming engine to receive real time rendering data

Parameters:
Name Type Attributes Description
connectionInfo object

Connection information returned by startSession or joinSession

hardwareDecoding boolean <optional>

Set to true to decode frame through a video tag element, default to false.

hevcSupport boolean <optional>

Set to true to enable HEVC decoding, default to true if hardwareDecoding is set to true.

# updateControllerSetting(controllerSettings)

Update controller settings such as speed or sensitivity.

Parameters:
Name Type Description
controllerSettings object