viro icon indicating copy to clipboard operation
viro copied to clipboard

Feature Request - Dynamic AR Tracking Targets

Open robertjcolley opened this issue 3 years ago β€’ 6 comments

While creating a tracking target, you cannot have a source be from a URI. If a developer wanted to store tracking targets in a database, and then fetch them and dynamically create targets for users, they cannot.

ViroARTrackingTargets.createTargets({
    targetOne: {
      source: {uri: props.sceneNavigator.viroAppProps.image},
      // source: require('../../assets/image_marker.png'),
      orientation: 'Up',
      // physicalWidth: 0.32, // real world width in meters
      physicalWidth: 0.1, // real world width in meters
    },
  });

robertjcolley avatar Jan 25 '22 18:01 robertjcolley

I believe the ::createTargets can be called at anytime, am I right?

doranteseduardo avatar Jan 31 '22 19:01 doranteseduardo

@robertjcolley I create targets during the running of the app and the image sources are server side, can show you it working if you like?

Foosballfan avatar Jan 31 '22 22:01 Foosballfan

Hi I use dynamic target from firebase and it is working well since a long time. i don’t use viroappproprops because I parse my firebase (json) to extract all data of a viro scene. i was having issue when the create target was call too early and the data from redux was not already retrieve. As @doranteseduardo say it can be called at any time. i can make a little repro if needed.

Cchumi avatar Feb 01 '22 05:02 Cchumi

@Foosballfan @Cchumi If one of you references a small repo, I can update the docs and close this issue. Thanks!

This was in response to someone having an issue. If working correctly, I'll close!

robertjcolley avatar Feb 01 '22 15:02 robertjcolley

There is a problem with files stored on the device - it seems the library works with either bundled files or remote, but it I'm trying to specify:

source: {uri: `file:///var/mobile...`},

I got Error converting data into image target and in the stack I see [VRTARImageTargetPromise fetch]_block_invoke

tadjik1 avatar Aug 14 '22 10:08 tadjik1

There is a problem with files stored on the device - it seems the library works with either bundled files or remote, but it I'm trying to specify:

source: {uri: `file:///var/mobile...`},

I got Error converting data into image target and in the stack I see [VRTARImageTargetPromise fetch]_block_invoke

I looked at the source code. That error means that is successfully download the image from the URL but the data wasn't recognized by the platform as a known image type and failed creating the native UIImage from the data. Check to ensure that it's a common image type and check the download link that it's actually pointing to an image.

MarcusAdams avatar Jun 08 '23 20:06 MarcusAdams