starter-kit icon indicating copy to clipboard operation
starter-kit copied to clipboard

Marker based AR not working

Open retr00h opened this issue 3 years ago • 0 comments

Hello

I need to implement an AR feature based on image tracking. I tried using this repo to try implementing part of that feature, and following the image recognition documentation I registered the target image and wrapped the "hello world" text in an image marker, resulting in the following (the ... represent code that hasn't been modified after cloning the repo):

import { ..., ViroARImageMarker, ViroARTrackingTargets } from '@viro-community/react-viro';

ViroARTrackingTargets.createTargets({
  "logo": {
      source: require('./logo.png'),
      orientation: "Up",
      physicalWidth: 0.1 // real world width in meters
      type: "Image"
  },
});

const HelloWorldSceneAR = () => {
  ...
  return (
    <ViroARScene onTrackingUpdated={onInitialized}>
      <ViroARImageMarker target={"logo"}>
        <ViroText
          text={text}
          scale={[0.5, 0.5, 0.5]}
          position={[0, 0, -1]}
          style={styles.helloWorldTextStyle}
        />
      </ViroARImageMarker>
    </ViroARScene>
  );
};
...

This is the aforementioned logo.png, however, the text isn't appearing over it when looking at it with the camera. How can I solve this?

logo

retr00h avatar Apr 29 '22 09:04 retr00h