Skip to main content

XR8.XrController.configure()

XrController.configure({ disableWorldTracking, enableLighting, enableWorldPoints, enableVps, imageTargets: [], leftHandedAxes, mirroredDisplay, projectWayspots, scale })

Description

Configures the processing performed by XrController (some settings may have performance implications).

Parameters

ParameterTypeDefaultDescription
disableWorldTracking [Optional]BooleanfalseIf true, turn off SLAM tracking for efficiency. This needs to be done BEFORE XR8.run() is called.
enableLighting [Optional]BooleanfalseIf true, lighting will be provided by XR8.XrController.pipelineModule() as processCpuResult.reality.lighting
enableWorldPoints [Optional]BooleanfalseIf true, worldPoints will be provided by XR8.XrController.pipelineModule() as processCpuResult.reality.worldPoints.
enableVps [Optional]BooleanfalseIf true, look for Project Locations and a mesh. The mesh that is returned has no relation to Project Locations and will be returned even if no Project Locations are configured. Enabling VPS overrides settings for scale and disableWorldTracking.
imageTargets [Optional]ArrayList of names of the image target to detect. Can be modified at runtime. Note: All currently active image targets will be replaced with the ones specified in this list.
leftHandedAxes [Optional]BooleanfalseIf true, use left-handed coordinates.
mirroredDisplay [Optional]BooleanfalseIf true, flip left and right in the output.
projectWayspots [Optional]Array[]Subset of Project Locations names to exclusively localize against. If an empty array is passed, we will localize all nearby Project Locations.
scale [Optional]StringresponsiveEither responsive or absolute. responsive will return values so that the camera on frame 1 is at the origin defined via XR8.XrController.updateCameraProjectionMatrix(). absolute will return the camera, image targets, etc in meters. When using absolute the x-position, z-position, and rotation of the starting pose will respect the parameters set in XR8.XrController.updateCameraProjectionMatrix() once scale has been estimated. The y-position will depend on the camera's physical height from the ground plane.

IMPORTANT: disableWorldTracking: true needs to be set BEFORE both XR8.XrController.pipelineModule() and XR8.run() are called and cannot be modifed while the engine is running.

Returns

None

Example

XR8.XrController.configure({enableLighting: true, disableWorldTracking: false, scale: 'absolute'})

Example - Enable VPS

XR8.XrController.configure({enableVps: true})

Example - Disable world tracking

// Disable world tracking (SLAM)
XR8.XrController.configure({disableWorldTracking: true})
// Open the camera and start running the camera run loop
XR8.run({canvas: document.getElementById('camerafeed')})

Example - Change active image target set

XR8.XrController.configure({imageTargets: ['image-target1', 'image-target2', 'image-target3']})