{"_id":"5bec8a15287d1b00426efe06","category":{"_id":"5bec8a15287d1b00426efdcb","version":"5bec8a15287d1b00426efe54","project":"578c4badbd223d2000cc1441","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-08-01T23:04:12.838Z","from_sync":false,"order":8,"slug":"api-reference","title":"API Reference"},"project":"578c4badbd223d2000cc1441","user":"57bb7e47afc18c0e00529cf3","parentDoc":null,"version":{"_id":"5bec8a15287d1b00426efe54","project":"578c4badbd223d2000cc1441","__v":0,"forked_from":"5ba2b5747091250003437507","createdAt":"2018-04-23T20:03:35.726Z","releaseDate":"2018-04-23T20:03:35.726Z","categories":["5bec8a15287d1b00426efdc6","5bec8a15287d1b00426efdc7","5bec8a15287d1b00426efdc8","5bec8a15287d1b00426efdc9","5bec8a15287d1b00426efdca","5bec8a15287d1b00426efdcb","5bec8a15287d1b00426efdcc","5bec8a15287d1b00426efdcd","5bec8a15287d1b00426efdce"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.12.0","version":"2.12.0"},"githubsync":"","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-02-27T00:15:42.022Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":10,"body":"ViroARTrackingTargets contain the information required for AR tracking components such as [ViroARImageMarker](doc:viroarimagemarker) to work properly.\n\nBefore using an AR tracking component, a `ViroARTrackingTarget` should be created and referenced by name in the component itself.\n\nComponents that use `ViroARTrackingTargets`:\n[ViroARImageMarker](doc:viroarimagemarker) \n\n######Example use:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"ViroARTrackingTargets.createTargets({\\n  \\\"ben\\\" : {\\n    source : require('./res/ben.jpg'),\\n    orientation : \\\"Up\\\",\\n    physicalWidth : 0.157 // real world width in meters\\n  },\\n  \\\"targetOne\\\" : {\\n    source : require('./res/targetOne.jpg'),\\n    orientation : \\\"Up\\\",\\n    physicalWidth : 0.25 // real world width in meters\\n  }\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"static createTargets(targets:{[key:string]: any})\",\n    \"0-0\": \"This function creates the targets specified by the given targets object with the properties specified below under [Image Target Properties](doc:viroartrackingtargets#types-of-targets).\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"static deleteTarget(targetName)\",\n    \"0-0\": \"This function takes the name of one registered target and deletes it.\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Types of Targets\"\n}\n[/block]\n## Image Targets\n\nImage targets should be used with [ViroARImageMarkers](doc:viroarimagemarker) and they specify the properties of a given image.\n\n## Object Targets\n\nObject targets should be used with [ViroARObjectMarker](doc:viroarobjectmarker) and they specify the properties of a given object.\n\n### Properties\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"source\",\n    \"0-1\": \"**PropTypes.oneOfType( [PropTypes.shape( {uri:  PropTypes.string} ), PropTypes.number] )**\\n\\nThe source of the image to find.\",\n    \"1-0\": \"orientation\",\n    \"1-1\": \"**PropTypes.oneOf(['Up', 'Down', 'Left', 'Right'])**\\n\\nDetermines the orientation of the source image.\",\n    \"2-0\": \"physicalWidth\",\n    \"2-1\": \"**PropTypes.number**\\n\\nThe width of the image in the real world in meters.\",\n    \"3-1\": \"**PropTypes.oneOf(['Image', 'Object'])**\\n\\nDetermines the type of tracking target.\",\n    \"3-0\": \"type\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]","excerpt":"","slug":"viroartrackingtargets","type":"basic","title":"ViroARTrackingTargets"}

ViroARTrackingTargets


ViroARTrackingTargets contain the information required for AR tracking components such as [ViroARImageMarker](doc: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](doc:viroarimagemarker) ######Example use: [block:code] { "codes": [ { "code": "ViroARTrackingTargets.createTargets({\n \"ben\" : {\n source : require('./res/ben.jpg'),\n orientation : \"Up\",\n physicalWidth : 0.157 // real world width in meters\n },\n \"targetOne\" : {\n source : require('./res/targetOne.jpg'),\n orientation : \"Up\",\n physicalWidth : 0.25 // real world width in meters\n }\n});", "language": "javascript" } ] } [/block] [block:api-header] { "title": "Methods" } [/block] [block:parameters] { "data": { "h-0": "static createTargets(targets:{[key:string]: any})", "0-0": "This function creates the targets specified by the given targets object with the properties specified below under [Image Target Properties](doc:viroartrackingtargets#types-of-targets)." }, "cols": 1, "rows": 1 } [/block] [block:parameters] { "data": { "h-0": "static deleteTarget(targetName)", "0-0": "This function takes the name of one registered target and deletes it." }, "cols": 1, "rows": 1 } [/block] [block:api-header] { "title": "Types of Targets" } [/block] ## Image Targets Image targets should be used with [ViroARImageMarkers](doc:viroarimagemarker) and they specify the properties of a given image. ## Object Targets Object targets should be used with [ViroARObjectMarker](doc:viroarobjectmarker) and they specify the properties of a given object. ### Properties [block:parameters] { "data": { "h-0": "Property Name", "h-1": "Description", "0-0": "source", "0-1": "**PropTypes.oneOfType( [PropTypes.shape( {uri: PropTypes.string} ), PropTypes.number] )**\n\nThe source of the image to find.", "1-0": "orientation", "1-1": "**PropTypes.oneOf(['Up', 'Down', 'Left', 'Right'])**\n\nDetermines the orientation of the source image.", "2-0": "physicalWidth", "2-1": "**PropTypes.number**\n\nThe width of the image in the real world in meters.", "3-1": "**PropTypes.oneOf(['Image', 'Object'])**\n\nDetermines the type of tracking target.", "3-0": "type" }, "cols": 2, "rows": 4 } [/block]