altspace

The main module for the AltspaceVR SDK.

Classes

AltRenderer
Document
Enclosure
Gamepad
GamepadButton
Popup
TrackingJoint
TrackingSkeleton
User

Members

(static) inClient :Boolean

True if the app is running inside AltspaceVR.

Methods

(static) getDocument() → {Promise}

Get a three.js object that represents the visible 2D DOM content of an enclosure. Returns a promise that resolves with a Document object.

(static) getEnclosure() → {Promise}

Gets the enclosure for the app. The resulting promise resolves to an Enclosure.

(static) getGamepads() → {Array}

Get a list of currently connected gamepads. Currently this requires polling this function until it returns a non-empty array. Connected gamepads are represented as Gamepad objects. This should work with a range of gamepads, but has only been tested with an Xbox One and HTC Vive controllers on Windows.

(static) getSpace() → {Promise}

Gets the space that the app is running in. The resulting promise resolves to a Space

(static) getThreeJSDebugInfo() → {Promise}

Retrieves debug information about 3D objects in an app. The resulting promise resolves to an array of ThreeJSDebugInfo objects.

(static) getThreeJSRenderer() → {AltRenderer}

Gets the renderer instance for this app.

(static) getThreeJSTrackingSkeleton() → {Promise}

Get the tracking skeleton representing the body of the current user. The resulting promise resolves to a TrackingSkeleton object.

(static) getUser() → {Promise}

Gets the current user. The resulting promise resolves to a User object.

(static) open(url, targetopt, optsopt) → {Promise}

Open a URL in a user's private browser. The resulting promise resolves to a Popup object. The target of the popup can either be '_blank' or '_experience'. The '_blank' target will open the URL in the user's "Web" panel. The '_experience' target allows you to augment the Altspace UI with a new button in the user's menu. When users click on the button, the popup will open in their private UI with the URL you provide. By default, the button will display the favicon associated with the URL. This gives you richer control of the user's experience when your app is loaded in a space.

Parameters:
Name Type Attributes Default Description
url String

The full URL that should be opened in the popup.

target String <optional>
'_blank'

Either '_experience' or '_blank'

opts Object <optional>

Options for the popup

Properties
Name Type Attributes Default Description
icon Object <optional>

The full URL to an icon. The icon must be a square PNG or JPG. If omitted, the favicon will be based on the popup URL's host.

hidden Object <optional>
false

Whether to hide the popup by default.

Type Definitions

Space

Details of a space.

Properties:
Name Type Description
sid String

Unique id for this space.

name String

The space's display name.

templateSid String

Id for the template that the space is based on. E.g. "conference-room-base", "game-room-base", etc.

ThreeJSDebugInfo

Debug information about an object in an app.

Properties:
Name Type Description
uuid String

The Three.js UUID for this object.

vertexCount Number

Number of vertices in this object's geometry.

isVisible Boolean

If this object is visible in the scene

isMaterialVisible Boolean

If this object's material is visible.

isCulled Boolean

If this object has been culled due to it moving out of the app enclosure bounds.

position Object

The object's position vector.

quaternion Object

The object's orientation quarternion.

TouchpadEvent

The TouchpadEvent interface represents events that occur due to the user interacting with the Samsung GearVR Touchpad

The best way to think about the units returned from the displacement properties is that they are the number of pixels that would be theoretically scrolled by swiping on the touchpad. Due to built-in acceleration, this can range from approximately 300 to 700 pixels for a full swipe of the touchpad. The coordinate system can also be thought of as the value you would add to the document position to scroll due to the swipe. (left is +x, up is +y)

Properties:
Name Type Description
displacementX Number

The horizontal distance that the user has dragged their finger since pressing it on the touchpad. Sliding the finger left on the touchpad increases this value

displacementY Number

The vertical distance that the user has dragged their finger since pressing it on the touchpad. Sliding the finger up on the touchpad increases this value

Events

touchpaddown

The touchpaddown event is fired from the altspace object when the user presses their finger down on the touchpad. The displacement for this event will always be [0, 0]

Type:

touchpadgesture

The touchpadgesture event is fired from the altspace object when the user lifts their finger off the touchpad. If it is within a minimum radius, a tap is triggered. Otherwise the primary direction of movement is used to generate a directional gesture.

Properties:
Name Type Description
gesture TouchpadGesture

One of 'tap', 'up', 'down', 'left', 'right'

touchpadmove

The touchpadmove event is fired from the altspace object while the user slides their finger across the trackpad.

Type:

touchpadup

The touchpadup event is fired from the altspace object when the user lifts their finger up from the touchpad.

Type: