viro
viro copied to clipboard
ViroReact ViroARImageMarker disable marker content if target is invisible and show when target isvisible
ViroARImageMarker content should show on target is visible. That is working fine.
But once the target is not visible then hide the marker content immediately.
You could maybe check out the anchor status, from the anchor object that you get when OnAnchorFound is called. "trackingMethod" could maybe work:
"The current tracking method used to keep track of the Image Marker Anchor. It can be one of the following values: "notTracking" - image marker hasn't yet been found "tracking" - image marker is actively being tracked "lastKnownPose" - image marker isn't currently being tracked but instead rendered based on its last known pose"
And then change the "visible" prop on your object accordingly?
https://docs.viromedia.com/docs/viroarscene#anchor
@HedwigAR Doesn't this only work for Android though?
Thankyou @HedwigAR for your valuable reply
We are startup developers so we are not sure how to implement those status. Project's deadline is about to end but not able to overcone this scenario.
Will you please provide some sample code. In anchorfound and anchorupdate events we are not also able to get "Anchor"parameter. while trying to get it we are getting it as undefined.
We are developing Viroreact application on windows operating system. Application for android devices.
Application is created by steps into below URL: https://docs.viromedia.com/docs/quick-start-windows
Thankyou @HedwigAR for your valuable reply
We are startup developers so we are not sure how to implement those status. Project's deadline is about to end but not able to overcone this scenario.
Will you please provide some sample code. In anchorfound and anchorupdate events we are not also able to get "Anchor"parameter. while trying to get it we are getting it as undefined.
We are developing Viroreact application on windows operating system. Application for android devices.
Application is created by steps into below URL: https://docs.viromedia.com/docs/quick-start-windows
So my guess would be something like
<ViroARScene onAnchorFound=(anchor)=>{this.yourFunction}>
yourFunction(anchor){
if(anchor.trackingMethod === "lastKnownPose"){
}
}
@HedwigAR does anchor tracking methods support IOS
Please reply m in urgent need.
@ControlAndC No, it's Android only
a
So my guess would be something like
<ViroARScene onAnchorFound=(anchor)=>{this.yourFunction}>
yourFunction(anchor){ if(anchor.trackingMethod === "lastKnownPose"){ } }
Don't work. I tried doing this at first only. But after visible=False, I couldn't see the image anymore.
For future reference: The onAnchorFound function runs on IOS only when the target is visible.
So for IOS, simply set a timer and on every onAnchorUpdated clear the timer and set it again. The code inside the timer will execute when the ImageMarker is not visible (same with lastKnownPose), and the code outside the timer but inside
if (anchor.trackingMethod === undefined) { }
will act as a "tracking" equivalent on IOS.
P.S. It's a good idea to throttle the function that runs onAnchorUpdated, otherwise it runs too many times, like once per frame.