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
| Parameter | Type | Default | Description |
|---|---|---|---|
| disableWorldTracking [Optional] | Boolean | false | If true, turn off SLAM tracking for efficiency. This needs to be done BEFORE XR8.run() is called. |
| enableLighting [Optional] | Boolean | false | If true, lighting will be provided by XR8.XrController.pipelineModule() as processCpuResult.reality.lighting |
| enableWorldPoints [Optional] | Boolean | false | If true, worldPoints will be provided by XR8.XrController.pipelineModule() as processCpuResult.reality.worldPoints. |
| imageTargetData [Optional] | Array | List 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] | Boolean | false | If true, use left-handed coordinates. |
| mirroredDisplay [Optional] | Boolean | false | If true, flip left and right in the output. |
| scale [Optional] | String | responsive | Either 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
| Property | Type | Description |
|---|---|---|
| imagePath | String | The path or URL to fetch the tracked image from. For best results, use a portrait, 480x640, grayscale image. |
| type | String | 'PLANAR', 'CYLINDER', or 'CONICAL' |
| properties | Object | Properties of the crop and geometry of the target. This should be generated by image-target-cli or the desktop app. |
| metadata [Optional] | any | This 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'),
],
})