Search Unity

3d object tracking, changing tracked object prefab based on which reference object is detected

Discussion in 'Handheld AR' started by pwshaw, Sep 9, 2019.

  1. pwshaw

    pwshaw

    Joined:
    Sep 16, 2014
    Posts:
    7
    I'm using object tracking (using 3d scans), and specifically I am wanting to know how to change the Tracked Object Prefab depending on which Reference Object has been detected. Has anyone solve this issue?
     
    Last edited: Sep 12, 2019
  2. pwshaw

    pwshaw

    Joined:
    Sep 16, 2014
    Posts:
    7
    I'm trying to use a specific XRReferenceObject within a XRReferenceObjectLibrary.

    So what is AR foundations approach for accessing a variable like this?

    Here's an if statement showing what I'm trying to do:

    if (XRReferenceObject.name, from XRReferenceObjectLibrary, is detected)
    {
    ARTrackedObject equals prefab1;
    }

    I want to make sure I have the correct variable names. Some example code would be extremely helpful. Thank you.