Skip to main content

XR8.XrController.configure()

XrController.configure({ disableWorldTracking, enableLighting, enableWorldPoints, imageTargets: [], leftHandedAxes, mirroredDisplay, 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.
imageTargetData [Optional]ArrayList of image targets to track, see image target data. 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.
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.

Image Target Data​

PropertyTypeDescription
imagePathStringThe path or URL to fetch the tracked image from. For best results, use a portrait, 480x640, grayscale image.
typeString'PLANAR', 'CYLINDER', or 'CONICAL'
propertiesObjectProperties of the crop and geometry of the target. This should be generated by image-target-cli or the desktop app.
metadata [Optional]anyThis property can be used to attach any additional data for use by the application.

Returns​

None

Example​

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

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({
imageTargetData: [
require('../image-targets/my-target.json'),
],
})