0
votes

I am building this app, that will recognize painting and will display the info about it with the help of AR. And I need to call multiple image target but not simultaneously, it will only call the image target if it is detected by AR camera.

*Ive tried creating many scenes with Image target on it but I cant call different imagetarget it keeps on reverting to only 1 imagetarget.

This is wat you can see in menu,

Main menu

  • Start AR camera(This part should have many image target but not detecting it simultaneously)
  • Help(how to use the app)
  • Exit

*Im using vuforia in creating AR

Thanks in advance for those who will help me.

This is the imagetarget and its Database

View post on imgur.com

1
why u guys downvoted it?Jinsen
put you code here. may be even upload project to some where, then ppl can look at it and help you.maximelian1986

1 Answers

0
votes

Run the multi target scene sample. There are three target (stone, wood and road).

Each contains the TrackableBehaviour component.

Grab it and disable it in Start. If you do it in Awake it will be set back to active most likely in the Awake of the component itself or via some other manager.

public class TrackerController:MonoBehaviour
{
    private IDictionary<string,TrackableBehaviours> trackers = null;

    private void Start()
    {
         this.trackers = new Dictionary<string,TrackableBehaviour>();
         var trackers = FindObjectsOfType<TrackableBehaviour>();
         foreach(TrackingBehaviour tb in trackers)
         {
              this.trackers.Add(tb.TrackableName, tb);
              tb.enabled = false;
         }
    }
    public bool SetTracker(string name, bool value)
    {
         if(string.IsNullOrEmpty(name) == true){ return false; }
         if(this.trackers.ContainsKey(name) == false){ return false; }
         this.trackers[name].enabled = value;          
         return true;
    }
}

The method finds all TrackableBehaviour and places them in a dictionary for easy access. The setting method return boolean, you can change it to throw exception or else.