10

Vuforia unit pause tracking or increase

 2 years ago
source link: https://www.codesd.com/item/vuforia-unit-pause-tracking-or-increase.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Vuforia unit pause tracking or increase

advertisements

I have developed a 3d object detection AR app successfully. When a 3d object is shown, upon detecting, the app shows some 3d Unity game objects which are hierarchal in vuforia object tracker . I want to give users an option in case if they don't have 3d object to detect, simply simulate as if object is detected and show the related 3d objects with the click of button. could someone guide me please?


I would assume you have the OnTrackingFound/OnTrackingLost methods. Inside, it sets all the objects (or the parent) on. You simply need to tell that you only want one:

public GameObject objA, objB, objC;
private GameObject currentObj = null;
private bool isTracking = false;
private void Start()
{
     if(objA == null) { Debug.LogError("Missing objext"); }
     if(objB == null) { Debug.LogError("Missing objext"); }
     if(objC == null) { Debug.LogError("Missing objext"); }
}
void OnTrackingFound()
{
    this.isTracking = true;
    OnTrackingLost();
    if(currentObj != null) { currentObj.SetActive(true); }
}
void OnTrackingLost()
{
    this.isTracking = false;
    objA.SetActive(false); objB.SetActive(false); objC.SetActive(false);
}
public void SetObjectWithUI(GameObject obj)
{
    this.current = obj;
    if (this.isTracking == true){ OnTrackingFound(); }
}

You add three buttons on your UI and use SetObjectWithUI as event. Then in the GameObject slot, you drag the three different game object you want to show. When you press a button, based on current tracking it will either reset or do nothing.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK