- Home /
Question by
sunflowerchocolate · Mar 28, 2018 at 12:13 PM ·
vuforiaaugmented-reality
How to make text disappear once the app recognizes an image target (via Vuforia)?
How to make text disappear once the app recognizes an image target (via Vuforia)?
I'm trying to create an AR app which tells users instructions before they place their phone camera on a greeting card. How can I make this text disappear once the user projects their camera on the greeting card and recognizes one of the image targets associated with the card?
Using Vuforia for the AR App
Comment
Are you asking how to make the text diappear or how to know when an image target has been recognized? Or both?
Answer by esnho · Apr 06, 2018 at 10:14 PM
Hello @sunflowerchocolate in the imagetarget replace the DefaultTrackableEventHandler component with this component
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Vuforia;
public class CustomTrackableEventHandler : DefaultTrackableEventHandler {
public GameObject TheText;
protected override void OnTrackingFound()
{
base.OnTrackingFound ();
TheText.SetActive(false);
}
protected override void OnTrackingLost() {
// you can even do something on tracking lost
base.OnTrackingLost ();
}
}