ViroARTrackingTargets

ViroARTrackingTargets contain the information required for AR tracking components such as ViroARImageMarker to work properly.

Before using an AR tracking component, a ViroARTrackingTarget should be created and referenced by name in the component itself.

Components that use ViroARTrackingTargets: ViroARImageMarker and ViroARObjectMarker

Example use:
ViroARTrackingTargets.createTargets({
  "ben": {
    source: require('res/ben.png'),
    orientation: "Up",
    physicalWidth: 0.157, // real world width in meters  
    type: 'Image'
  },
  "targetOne": {
    source: require('res/targetOne.png'),
    orientation: "Up",
    physicalWidth: 0.25, // real world width in meters
    type: 'Image'
  }
});

Methods

static createTargets(targets:{[key:string]: any})

Description
This function creates the targets specified by the given targets object with the properties specified below under Image Target Properties.

static deleteTarget(targetName)

Description
This function takes the name of one registered target and deletes it.

Types of Targets

Image Targets

Image targets should be used with ViroARImageMarkers and they specify the properties of a given image.

Object Targets

Object targets should be used with ViroARObjectMarker and they specify the properties of a given object.

ViroTrackingTarget

source

TypeDescription
ImageSourcePropTypeThe source of the image to find. An asset can be loaded by using require() or { uri: 'https://example.com/your-image.png' }

orientation

TypeDescription
'Up' | 'Down' | 'Left' | 'Right'Determines the orientation of the source image.

physicalWidth

TypeDescription
numberThe width of the image in the real world in meters.

type

TypeDescription
'Image' | 'Object'Determines the type of tracking target.