RealityAPIΒΆ
Interface RealityAPI
Hierarchy
- RealityAPI
Index
Methods
Methods
connectXRSession
- connectXRSession(): Promise<XRSessionState>
Experimental
Connects to the XR Session.
Returns Promise<XRSessionState>
Returns a Promise with the current XRSessionState.
enterXRMember Init Mode
- enterXRMember
Init Mode(memberId, xrInitOptions?): Promise<boolean> Experimental
Enters the initialization phase for modeltracking. This is also used to reset the current modeltracking. It will also trigger a XRMemberStateChangedEvent event with FIXATED set to false. By default the modeltracking will be softreset. If you choose to reset different data on the modeltracker you can do so by specifying the XRInitOptions.
Parameters
-
memberId: number
The XRMember that the operation should be applied on.
-
Optional
xrInitOptions: XRInitOptionsSpecify initialization options. E.g. reset behavior of modeltracker. Default is softreset.
Returns Promise<boolean>
Returns a Promise which reports whether the operation was successful or not.
-
exitXRMember Init Mode
- exitXRMember
Init Mode(memberId): Promise<boolean> Experimental
Exits the initialization phase for modeltracking, this will also anchor the model at the current position.
Parameters
-
memberId: number
The XRMember that the operation should be applied on.
Returns Promise<boolean>
Returns a Promise which reports whether the operation was successful or not.
-
exportXRInit Template
- exportXRInit
Template(memberId): Promise<string> Experimental
Exports init template for modeltracking. Usage: After a successful tracking session, the learned init template data can be exported with this function and stored for later.
Only supported if the XRMember has the MODELTRACKER capability.
The aquired data can be imported via importXRInitTemplate function
Parameters
-
memberId: number
the XRMember that the operation should be applied on
Returns Promise<string>
base64 encoded init template data
-
fixateXRMember
- fixateXRMember(memberId): Promise<boolean>
Experimental
Anchors the model at the current position. It will also trigger a XRMemberStateChangedEvent event with FIXATED set to true.
Parameters
-
memberId: number
The XRMember that the operation should be applied on.
Returns Promise<boolean>
Returns a Promise which reports whether the operation was successful or not.
-
getXRMember Info
- getXRMember
Info(memberId): XRMemberInfo Experimental
Get the XRMemberInfo for a given XRMember.
Parameters
-
memberId: number
The XRMember that the operation should be applied on.
Returns XRMemberInfo
Returns an XRMemberInfo struct containing all relevant infos (memberId, XRCapabilities, sessionMemberData) for the given member.
-
getXRMember State
- getXRMember
State(memberId): XRMemberState Experimental
Get the runtime state of a given XRMember.
Parameters
-
memberId: number
The XRMember that the state should be queried from.
Returns XRMemberState
Returns either the member state if the member exist or return undefined if XR is not connected or the memberId does not exist.
-
getXRMembers
getXRSession State
- getXRSession
State(): XRSessionState Experimental
Get the current XRSessionState. This method can be used to check if the XR session is currently connected.
Returns XRSessionState
Returns the current XRSessionState.
importXRInit Template
- importXRInit
Template(memberId, template): Promise<void> Experimental
Imports init template for modeltracking. When using Model tracking, Init templates are captured during the tracking process. This initialization data is linked to previously visited view-points along the traveled camera path. Once the tracking is lost the templates are used to quickly reinitialize from similar view-points without the user having to align the line model with the real object.
Once the init template data is imported. It will stay until enterInitMode with resetInitTemplate set to true is called.
Only supported if the XRMember has the MODELTRACKER capability.
The input data can be aquired via exportXRInitTemplate function
Parameters
-
memberId: number
the XRMember that the operation should be applied on
-
template: string
Returns Promise<void>
-
requestXMember Capabilities
- requestXMember
Capabilities(memberId): Promise<boolean> Experimental
Execute whatever is necessary to enable XRCapbilities on the given member, e.g. start the camera or forward to the booster.
Parameters
-
memberId: number
The XRMember that the operation should be applied on.
Returns Promise<boolean>
Returns a Promise which reports whether the operation was successful or not.
-
resetAR
setXRFusion Mode
- setXRFusion
Mode(memberId, xrFusionMode): Promise<boolean> Experimental
Sets the passed fusion mode for the given XRMember. The fusion mode determines which inputs will be used for the final visualization.
Parameters
-
memberId: number
the XRMember that the operation should be applied on
-
xrFusionMode: XRFusionMode
the fusion mode that should be set
Returns Promise<boolean>
returns a Promise which reports whether the operation was successful or not
-
setXRMember Settings
- setXRMember
Settings(memberId, settings): Promise<boolean> Experimental
This will change the XRMemberSettings for the specified XRMember.
Parameters
-
memberId: number
The XRMember that the operation should be applied on.
-
settings: XRMemberSettings
The quality threshold for the modeltracker must be between 0 and 1
Returns Promise<boolean>
Returns a Promise which reports whether the operation was successful or not.
-
show Expert Dialog
startAR
- startAR(): Promise<boolean>
-
Returns Promise<boolean>
returns true if starting was successfull or false if it could not start AR
Deprecated
Start AR. Projects the camera stream in the background and starts searching for the given reference. The reference is defined by setting the realproperty on the particular node via the webvis API. E.g. webvis.setProperty(0, pluginAPI.realProperty, pluginAPI.realState.Enabled)
startXRMember Spectate
- startXRMember
Spectate(memberId): Promise<boolean> Experimental
Puts the image stream in the background of the renderer. It will also trigger a XRMemberStateChangedEvent event with FOLLOWING set to true.
Parameters
-
memberId: number
The XRMember that the operation should be applied on.
Returns Promise<boolean>
Returns a Promise which reports whether the operation was successful or not.
-
stopAR
stopXRMember Spectate
- stopXRMember
Spectate(memberId): Promise<boolean> Experimental
Stops the image stream in the background of the renderer. It will also trigger a XRMemberStateChangedEvent event with FOLLOWING set to false.
Parameters
-
memberId: number
The XRMember that the operation should be applied on.
Returns Promise<boolean>
Returns a Promise which reports whether the operation was successful or not.
-
unfixateXRMember
- unfixateXRMember(memberId): Promise<boolean>
Experimental
Unfixates the model. The model will move with the device. It will also trigger a XRMemberStateChangedEvent event with FIXATED set to false.
Parameters
-
memberId: number
The XRMember that the operation should be applied on.
Returns Promise<boolean>
Returns a Promise which reports whether the operation was successful or not.
-
The RealityAPI provides functionalities for controlling an XRSession together with all XR capable members.
Example