Options
All
  • Public
  • Public/Protected
  • All
Menu

Mixed Reality Extension SDK

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

ActionHandler

ActionHandler<ActionDataT>: (user: User, actionData?: ActionDataT) => void

The action handler function type.

Type parameters

  • ActionDataT

Type declaration

    • (user: User, actionData?: ActionDataT): void
    • Parameters

      • user: User
      • Optional actionData: ActionDataT

      Returns void

ActionState

ActionState: "started" | "performing" | "stopped"

AdapterOptions

AdapterOptions: { port?: string | number; server?: Server }

Adapter options

Type declaration

  • Optional port?: string | number
    member

    {string | number} port Optional. When options.server is not supplied and an internal web server is to be created, this is the port number it should listen on. If this value is not given, it will attempt to read the PORT environment variable, then default to 3901

  • Optional server?: Server
    member

    {http.Server} server Provide an existing web server to use. Will create one otherwise

AnimateToOptions

AnimateToOptions<T>: { destination: Partial<Like<T>>; duration: number; easing?: EaseCurve }

Options for Animation.AnimateTo.

Type parameters

Type declaration

  • destination: Partial<Like<T>>

    A collection of property values that should be animated, and the desired final values.

  • duration: number

    The amount of time in seconds it takes to reach the destination value.

  • Optional easing?: EaseCurve

    How the values should approach their destinations. Defaults to AnimationEaseCurves.Linear.

Animatible

Animatible: Actor

The types that support animation

AnimationCreationMessage

AnimationCreationMessage: Message<Payloads.CreateAnimation2 | Payloads.CreateActorCommon>

AnimationProp

AnimationProp: Vector2 | Vector3 | Quaternion | Color3 | Color4 | number | string | boolean

The types that are acceptable targets of animations.

AssetCreationMessage

AssetCreationMessage: Message<Payloads.LoadAssets | Payloads.CreateAsset>

AttachPoint

AttachPoint: "none" | "camera" | "head" | "neck" | "hips" | "center-eye" | "spine-top" | "spine-middle" | "spine-bottom" | "left-eye" | "left-upper-leg" | "left-lower-leg" | "left-foot" | "left-toes" | "left-shoulder" | "left-upper-arm" | "left-lower-arm" | "left-hand" | "left-thumb" | "left-index" | "left-middle" | "left-ring" | "left-pinky" | "right-eye" | "right-upper-leg" | "right-lower-leg" | "right-foot" | "right-toes" | "right-shoulder" | "right-upper-arm" | "right-lower-arm" | "right-hand" | "right-thumb" | "right-index" | "right-middle" | "right-ring" | "right-pinky"

The complete set of attach points.

AutoColliderGeometry

AutoColliderGeometry: { shape: Auto }

A best-guess shape for the currently assigned mesh

Type declaration

BehaviorType

BehaviorType: "none" | "target" | "button"

These are the behavior types available to set on an actor.

BoxColliderGeometry

BoxColliderGeometry: { center?: Readonly<Vector3Like>; shape: Box; size?: Readonly<Vector3Like> }

Collider parameters specific to a box collider

Type declaration

  • Optional center?: Readonly<Vector3Like>
  • shape: Box
  • Optional size?: Readonly<Vector3Like>

BoxPrimitiveDefinition

BoxPrimitiveDefinition: { dimensions?: Partial<Vector3Like>; shape: Box }

Type declaration

  • Optional dimensions?: Partial<Vector3Like>

    The bounding box size of the primitive.

  • shape: Box

CapsuleColliderGeometry

CapsuleColliderGeometry: { center?: Readonly<Vector3Like>; shape: Capsule; size?: Readonly<Vector3Like> }

Collider parameters specific to a capsule collider

Type declaration

  • Optional center?: Readonly<Vector3Like>
  • shape: Capsule
  • Optional size?: Readonly<Vector3Like>

CapsulePrimitiveDefinition

CapsulePrimitiveDefinition: { dimensions?: Partial<Vector3Like>; shape: Capsule; uSegments?: number; vSegments?: number }

Type declaration

  • Optional dimensions?: Partial<Vector3Like>

    The bounding box size of the primitive.

  • shape: Capsule
  • Optional uSegments?: number

    The number of horizontal or radial segments of spheres, cylinders, capsules, and planes.

  • Optional vSegments?: number

    The number of vertical or axial segments of spheres, capsules, and planes.

ColliderGeometry

All collider parameter types.

CollisionEventState

CollisionEventState: "enter" | "exit"

The collision state for the collsion event.

CollisionEventType

CollisionEventType: "collision-enter" | "collision-exit"

The collision events that can be raised on a collider.

CollisionHandler

CollisionHandler: (data: CollisionData) => void

The collision handler to be called when a collision event occurs.

param

The collision data associated with the collision.

Type declaration

CreateColliderType

CreateColliderType: ColliderType | "none"

CylinderPrimitiveDefinition

CylinderPrimitiveDefinition: { dimensions?: Partial<Vector3Like>; shape: Cylinder; uSegments?: number }

Type declaration

  • Optional dimensions?: Partial<Vector3Like>

    The bounding box size of the primitive.

  • shape: Cylinder
  • Optional uSegments?: number

    The number of horizontal or radial segments of spheres, cylinders, capsules, and planes.

EaseCurve

EaseCurve: [number, number, number, number]

Control points of a cubic bezier curve. @see AnimationEaseCurves.

Keyframe

Keyframe<T>: { easing?: EaseCurve; time: number; value: Like<T> | TargetPath<T> }

The value of an animation property at a moment in time

Type parameters

Type declaration

  • Optional easing?: EaseCurve

    How the value approaches this frame's value. Defaults to the track's easing values.

  • time: number

    The time in seconds from the start of the animation.

  • value: Like<T> | TargetPath<T>

    The property's value at this instant, or a reference to another property.

LightType

LightType: "spot" | "point"

Like

Like<T>: T extends ActorLike ? ActorLike : T extends ActorTransformLike ? ActorTransformLike : T extends AnimationLike ? AnimationLike : T extends AnimationDataLike ? AnimationDataLike : T extends AppearanceLike ? AppearanceLike : T extends AssetLike ? AssetLike : T extends AttachmentLike ? AttachmentLike : T extends ColliderLike ? ColliderLike : T extends Color4Like ? Color4Like : T extends Color3Like ? Color3Like : T extends LightLike ? LightLike : T extends LookAtLike ? LookAtLike : T extends MaterialLike ? MaterialLike : T extends MeshLike ? MeshLike : T extends PrefabLike ? PrefabLike : T extends QuaternionLike ? QuaternionLike : T extends ScaledTransformLike ? ScaledTransformLike : T extends SoundLike ? SoundLike : T extends TextLike ? TextLike : T extends TextureLike ? TextureLike : T extends TransformLike ? TransformLike : T extends UserLike ? UserLike : T extends Vector3Like ? Vector3Like : T extends Vector2Like ? Vector2Like : T extends VideoStreamLike ? VideoStreamLike : T

Type parameters

  • T

MultipeerAdapterOptions

MultipeerAdapterOptions: AdapterOptions & { peerAuthoritative?: boolean }

Multi-peer adapter options

NetworkStatsReport

NetworkStatsReport: { networkBandwidthIn: [number, number, number]; networkBandwidthOut: [number, number, number]; networkMessageCount: [number, number, number] }

A collection of network statistics from a certain point in time.

Type declaration

  • networkBandwidthIn: [number, number, number]

    The average incoming bandwidth of this app over the last 1/5/30 seconds, in KB/s. This is roughly equivalent to the bandwidth sent by the busiest client over the interval, though does not correlate exactly. Only MRE internal traffic is counted, not general HTTP requests (static file hosting, etc.).

  • networkBandwidthOut: [number, number, number]

    The average outgoing bandwidth of this app over the last 1/5/30 seconds, in KB/s. This is roughly equivalent to the bandwidth sent to the busiest client over the interval, though this does not correlate exactly. Only MRE internal traffic is counted, not general HTTP requests (static file hosting, etc.).

  • networkMessageCount: [number, number, number]

    The number of messages sent and received by this app in the last 1/5/30 seconds. A high number might indicate that clients are wasting CPU cycles serializing and deserializing messages.

PerformanceStats

PerformanceStats: { actorCount: number; actorWithMeshCount: number; materialCount: number; meshCount: number; meshTrianglesTotal: number; meshVerticesTotal: number; networkBandwidthIn: [number, number, number]; networkBandwidthOut: [number, number, number]; networkMessageCount: [number, number, number]; prefabCount: number; soundCount: number; soundSecondsTotal: number; textureCount: number; texturePixelsAverage: number; texturePixelsTotal: number }

A snapshot of various stats useful for debugging and benchmarking. None of these correlate exactly with a particular client's experience, framerate, memory usage, etc., but should be generally indicative.

Type declaration

  • actorCount: number

    The number of actors in the scene.

  • actorWithMeshCount: number

    The number of visible actors with meshes assigned, not including library actors. For a mobile user with only one MRE running, this should generally be kept below 60, though higher can be done with judicious use of mesh/material reuse and instancing.

  • materialCount: number

    The number of loaded material assets.

  • meshCount: number

    The number of loaded mesh assets.

  • meshTrianglesTotal: number

    The total number of polygons of all loaded meshes.

  • meshVerticesTotal: number

    The total number of vertices of all loaded meshes. Corresponds to GPU memory usage.

  • networkBandwidthIn: [number, number, number]

    The average incoming bandwidth of this app over the last 1/5/30 seconds, in KB/s. This is roughly equivalent to the bandwidth sent by the busiest client over the interval, though does not correlate exactly. Only MRE internal traffic is counted, not general HTTP requests (static file hosting, etc.).

  • networkBandwidthOut: [number, number, number]

    The average outgoing bandwidth of this app over the last 1/5/30 seconds, in KB/s. This is roughly equivalent to the bandwidth sent to the busiest client over the interval, though this does not correlate exactly. Only MRE internal traffic is counted, not general HTTP requests (static file hosting, etc.).

  • networkMessageCount: [number, number, number]

    The number of messages sent and received by this app in the last 1/5/30 seconds. A high number might indicate that clients are wasting CPU cycles serializing and deserializing messages.

  • prefabCount: number

    The number of loaded prefab assets.

  • soundCount: number

    The number of loaded sound assets.

  • soundSecondsTotal: number

    The total number of seconds of loaded audio.

  • textureCount: number

    The number of loaded texture assets.

  • texturePixelsAverage: number

    [[texturePixelsTotal]] divided by [[textureCount]]. If this value exceeds 1024 * 1024 (roughly 1 000 000), clients may experience frame drops during loading.

  • texturePixelsTotal: number

    The total number of pixels of all loaded textures. Corresponds to GPU memory usage. Should be kept below 6 000 000 for mobile device clients.

PhysicsBridgeTransformUpdate

PhysicsBridgeTransformUpdate: { flags: number; id: Guid; time: number; transformCount: number; transformsBlob: string }

Type declaration

  • flags: number
  • id: Guid
  • time: number
  • transformCount: number
  • transformsBlob: string

PhysicsBridgeUpdate

PhysicsBridgeUpdate: Payloads.Payload & { transforms: Partial<PhysicsBridgeTransformUpdate>; type: "physicsbridge-transforms-update" }

PhysicsServerOneTransformUpdate

PhysicsServerOneTransformUpdate: { actorGuid: Guid; appTransform: TransformLike; localTransform: TransformLike }

Type declaration

PhysicsUploadServerTransformsUpdate

PhysicsUploadServerTransformsUpdate: { id: Guid; transformCount: number; updates: PhysicsServerOneTransformUpdate[] }

Type declaration

PhysicsUploadServerUpdate

PhysicsUploadServerUpdate: Payloads.Payload & { physicsTranformServer: Partial<PhysicsUploadServerTransformsUpdate>; type: "physicsbridge-server-transforms-upload" }

PlanePrimitiveDefinition

PlanePrimitiveDefinition: { dimensions?: Partial<Vector3Like>; shape: Plane; uSegments?: number; vSegments?: number }

Type declaration

  • Optional dimensions?: Partial<Vector3Like>

    The bounding box size of the primitive.

  • shape: Plane
  • Optional uSegments?: number

    The number of horizontal or radial segments of spheres, cylinders, capsules, and planes.

  • Optional vSegments?: number

    The number of vertical or axial segments of spheres, capsules, and planes.

PrimitiveDefinition

SetAudioStateOptions

SetAudioStateOptions: { doppler?: number; looping?: boolean; paused?: boolean; pitch?: number; rolloffStartDistance?: number; spread?: number; time?: number; volume?: number }

Parameters to the Actor.startSound call.

Type declaration

  • Optional doppler?: number

    the amount that sound pitch is modified when moving towards/away from sound source. For music and speech, set this to 0, but for regular objects set to 1.0 or higher (up to 5.0). Default to 1.0.

  • Optional looping?: boolean

    repeat the sound when ended, or turn it off after playing once

  • Optional paused?: boolean

    pause or unpause the sound. Default to false.

  • Optional pitch?: number

    pitch offset in halftones (0=default, 12=one octave higher, -12=one octave lower)

  • Optional rolloffStartDistance?: number

    Sounds will play at full volume until user is this many meters away, and then volume will decrease logarithmically. Default to 1.0. For sound that needs to fill up a large space (like a concert), increase this number.

  • Optional spread?: number

    Specify how much a sound is non-directional (playing the same volume in each speaker regardless of facing direction) vs directional (playing only in the speakers that are pointing towards the sound source). This can be used to make sounds seem more "wide". It is also useful for multi-channel sounds (such as music), because a fully directional sound will always sound like mono. Default to 0.0. For music and ambient looping sounds, set this between 0.5 and 1.0.

  • Optional time?: number

    The media should start at, or seek this many seconds into the media. Time is in seconds relative to start of clip.

  • Optional volume?: number

    volume multiplier, (0.0-1.0, where 0.0=no sound, 1.0=maximum)

SetMediaStateOptions

Parameters to the MediaInstance.setState call.

SetVideoStateOptions

SetVideoStateOptions: { looping?: boolean; paused?: boolean; rolloffStartDistance?: number; spread?: number; time?: number; visible?: boolean; volume?: number }

Parameters to the Actor.startVideoStream call.

Type declaration

  • Optional looping?: boolean

    repeat the video when ended, or turn it off after playing once

  • Optional paused?: boolean

    pause or unpause the video. Default to false.

  • Optional rolloffStartDistance?: number

    Sounds will play at full volume until user is this many meters away, and then volume will decrease logarithmically. Default to 1.0. For sound that needs to fill up a large space (like a concert), increase this number.

  • Optional spread?: number

    Specify how much a sound is non-directional (playing the same volume in each speaker regardless of facing direction) vs directional (playing only in the speakers that are pointing towards the sound source). This can be used to make sounds seem more "wide". It is also useful for multi-channel sounds (such as music), because a fully directional sound will always sound like mono. Default to 0.0. For music and ambient looping sounds, set this between 0.5 and 1.0.

  • Optional time?: number

    The media should start at, or seek this many seconds into the media. Time is in seconds relative to start of clip.

  • Optional visible?: boolean

    Should the video stream be visible or invisible

  • Optional volume?: number

    volume multiplier, (0.0-1.0, where 0.0=no sound, 1.0=maximum)

SphereColliderGeometry

SphereColliderGeometry: { center?: Readonly<Vector3Like>; radius?: number; shape: Sphere }

Collider parameters specific to a sphere collider.

Type declaration

  • Optional center?: Readonly<Vector3Like>
  • Optional radius?: number
  • shape: Sphere

SpherePrimitiveDefinition

SpherePrimitiveDefinition: { dimensions?: Partial<Vector3Like>; shape: Sphere; uSegments?: number; vSegments?: number }

Type declaration

  • Optional dimensions?: Partial<Vector3Like>

    The bounding box size of the primitive.

  • shape: Sphere
  • Optional uSegments?: number

    The number of horizontal or radial segments of spheres, cylinders, capsules, and planes.

  • Optional vSegments?: number

    The number of vertical or axial segments of spheres, capsules, and planes.

StaticBufferInfo

StaticBufferInfo: { buffer: Buffer; contentType: string; etag: string }

Type declaration

  • buffer: Buffer
  • contentType: string
  • etag: string

SubscriptionType

SubscriptionType: "transform" | "rigidbody" | "collider" | "rigidbody-velocity"

A type representing the different parts of an Actor that can be subscribed to. When subscribed, the Actor will receive updates when corresponding changes occur on the host.

TraceSeverity

TraceSeverity: "debug" | "info" | "warning" | "error"

Defines different log severity levels.

Track

Track<T>: { easing?: EaseCurve; keyframes: Array<Keyframe<T>>; relative?: boolean; target: TargetPath<T> }

The timeline of values for an animation target property

Type parameters

Type declaration

  • Optional easing?: EaseCurve

    Controls between-frame interpolation. Defaults to AnimationEaseCurves.Linear.

  • keyframes: Array<Keyframe<T>>

    The values to animate the target through

  • Optional relative?: boolean

    Whether the keyframe values are relative to 0 or to the target's current property value. Defaults to false.

  • target: TargetPath<T>

    A path to the property to animate

TriggerEventType

TriggerEventType: "trigger-enter" | "trigger-exit"

The trigger events that can be raised on a collider.

TriggerHandler

TriggerHandler: (otherActor: Actor) => void

The trigger handler to be called whan an actor has entered or exited a trigger volume.

param

The other actor that has entered the trigger volume.

Type declaration

    • (otherActor: Actor): void
    • Parameters

      Returns void

UserEntryExitCallback

UserEntryExitCallback: (user: User) => void

A callback that handles when a user joins or leaves the MRE session

Type declaration

    • (user: User): void
    • Parameters

      Returns void

UserInteractionType

UserInteractionType: "joined" | "input"

An event type for [[UserFilter.shouldForwardUserEvent]]

WebSocketAdapterOptions

WebSocketAdapterOptions: AdapterOptions

WebSocket Adapter options.

Variables

Const CurrentSDKVersion

CurrentSDKVersion: SemVer = semver.coerce(require('../../../package.json').version)

Const DegreesToRadians

DegreesToRadians: number

Constant used to convert an angle value in degrees to radians

Const Epsilon

Epsilon: 0.001 = 0.001

Constant used to define the minimal number value in Babylon.js

ignorenaming

Const MS_PER_NS

MS_PER_NS: 0.000001 = 0.000001

Const MS_PER_S

MS_PER_S: 1000 = 1000

Const MinimumSupportedClientVersion

MinimumSupportedClientVersion: SemVer = semver.coerce('0.20')

Const RadiansToDegrees

RadiansToDegrees: number

Constant used to convert an anglevalue radians to degrees

Const ToGammaSpace

ToGammaSpace: number

Constant used to convert a value to gamma space

ignorenaming

Const ToLinearSpace

ToLinearSpace: 2.2 = 2.2

Constant used to convert a value to linear space

ignorenaming

Const ZeroGuid

ZeroGuid: Guid = parseGuid(ZeroGuidString)

Const ZeroGuidString

ZeroGuidString: "00000000-0000-0000-0000-000000000000" = "00000000-0000-0000-0000-000000000000"

Const byteToHex

byteToHex: string[] = []

Const colWidth

colWidth: 30 = 30

Const columns

columns: string[] = ['session']

Const forwarded

forwarded: (res: IncomingMessage, headers: IncomingHttpHeaders) => { ip: string; port: number } = require('forwarded-for')

Type declaration

    • (res: IncomingMessage, headers: IncomingHttpHeaders): { ip: string; port: number }
    • Parameters

      • res: IncomingMessage
      • headers: IncomingHttpHeaders

      Returns { ip: string; port: number }

      • ip: string
      • port: number

Const log

log: Log = new Log()

Const readFile

readFile: __promisify__ = promisify(readFileNodeAsync)

Functions

ActorPath

InvertBoxAlignment

formatEvent

main

  • main(filename: string): Promise<void>

Const maxFn

  • maxFn(max: number, x: number): number

newGuid

observeLeafProperties

  • observeLeafProperties(target: any, path: string[], notifyChanged: (...path: string[]) => void, triggerNotificationsNow: boolean): void
  • Parameters

    • target: any
    • path: string[]
    • notifyChanged: (...path: string[]) => void
        • (...path: string[]): void
        • Parameters

          • Rest ...path: string[]

          Returns void

    • triggerNotificationsNow: boolean

    Returns void

parseEvent

  • parseEvent(network: string, contents: string): LogEvent

parseFile

  • parseFile(filename: string): Promise<LogEvent[]>

parseGuid

  • parseGuid(val: string): Guid

safeAccessPath

  • safeAccessPath(obj: any, ...path: any[]): any

Const sumFn

  • sumFn(sum: number, x: number): number

unobserveLeafProperties

  • unobserveLeafProperties(target: any): void

uuidParse

  • uuidParse(buf: ArrayLike<number>): string

Object literals

Const AnimationEaseCurves

AnimationEaseCurves: object

Predefined ease curves from https://easings.net/. Curve shapes can be previewed there. Create your own at http://cubic-bezier.com. Note: Curves that end with "Back" include some overshoot.

EaseInBack

EaseInBack: [number, number, number, number] = [0.6, -0.28, 0.735, 0.045] as EaseCurve

EaseInCircular

EaseInCircular: [number, number, number, number] = [0.6, 0.04, 0.98, 0.335] as EaseCurve

EaseInCubic

EaseInCubic: [number, number, number, number] = [0.55, 0.055, 0.675, 0.19] as EaseCurve

EaseInExponential

EaseInExponential: [number, number, number, number] = [0.95, 0.05, 0.795, 0.035] as EaseCurve

EaseInOutBack

EaseInOutBack: [number, number, number, number] = [0.68, -0.55, 0.265, 1.55] as EaseCurve

EaseInOutCircular

EaseInOutCircular: [number, number, number, number] = [0.785, 0.135, 0.15, 0.86] as EaseCurve

EaseInOutCubic

EaseInOutCubic: [number, number, number, number] = [0.645, 0.045, 0.355, 1] as EaseCurve

EaseInOutExponential

EaseInOutExponential: [number, number, number, number] = [1, 0, 0, 1] as EaseCurve

EaseInOutQuadratic

EaseInOutQuadratic: [number, number, number, number] = [0.455, 0.03, 0.515, 0.955] as EaseCurve

EaseInOutQuartic

EaseInOutQuartic: [number, number, number, number] = [0.77, 0, 0.175, 1] as EaseCurve

EaseInOutQuintic

EaseInOutQuintic: [number, number, number, number] = [0.86, 0, 0.07, 1] as EaseCurve

EaseInOutSine

EaseInOutSine: [number, number, number, number] = [0.445, 0.05, 0.55, 0.95] as EaseCurve

EaseInQuadratic

EaseInQuadratic: [number, number, number, number] = [0.55, 0.085, 0.68, 0.53] as EaseCurve

EaseInQuartic

EaseInQuartic: [number, number, number, number] = [0.895, 0.03, 0.685, 0.22] as EaseCurve

EaseInQuintic

EaseInQuintic: [number, number, number, number] = [0.755, 0.05, 0.855, 0.06] as EaseCurve

EaseInSine

EaseInSine: [number, number, number, number] = [0.47, 0, 0.745, 0.715] as EaseCurve

EaseOutBack

EaseOutBack: [number, number, number, number] = [0.175, 0.885, 0.32, 1.275] as EaseCurve

EaseOutCircular

EaseOutCircular: [number, number, number, number] = [0.075, 0.82, 0.165, 1] as EaseCurve

EaseOutCubic

EaseOutCubic: [number, number, number, number] = [0.215, 0.61, 0.355, 1] as EaseCurve

EaseOutExponential

EaseOutExponential: [number, number, number, number] = [0.19, 1, 0.22, 1] as EaseCurve

EaseOutQuadratic

EaseOutQuadratic: [number, number, number, number] = [0.25, 0.46, 0.45, 0.94] as EaseCurve

EaseOutQuartic

EaseOutQuartic: [number, number, number, number] = [0.165, 0.84, 0.44, 1] as EaseCurve

EaseOutQuintic

EaseOutQuintic: [number, number, number, number] = [0.23, 1, 0.32, 1] as EaseCurve

EaseOutSine

EaseOutSine: [number, number, number, number] = [0.39, 0.575, 0.565, 1] as EaseCurve

Linear

Linear: [number, number, number, number] = [0, 0, 1, 1] as EaseCurve

Linear: Move at constant speed.

Step

Step: [number, number, number, number] = [0, 0, 0, 0] as EaseCurve

Step: Do not interpolate.