Topic locked

Frame marker integration in UNITY

March 1, 2014 - 8:31pm #1

Hi everyone,

 

How do I integrate frame markers in UNITY? I had seen the vuforia youtube tutorial and they drag and drop the 3D model onto the target marker. But what if I would like to have a frame marker that shows a carrot for example and then another frame marker  is an apple, and when these 2 come close together it will become another 3D model like a rabbit for example. May I know how should I do it? and when I searched around the forum , i found that i will have to set the worldcentermode to "specific target" but then after that, what should I do?

Thank you very much .

Frame marker integration in UNITY

March 5, 2014 - 4:24am #9

Great!

Frame marker integration in UNITY

March 5, 2014 - 4:18am #8

Hi AlessandroB,

YAY it works!. Thank you very much for the help.  I really appreciate it very much. =).

 

Frame marker integration in UNITY

March 4, 2014 - 7:37am #7

Your code contains a basic and fundamental logic error, as it simply checks if a given target has name=="A" and name=="B" at the same time, which is impossible by definition;

what I would do is something along the lines of this:

bool found_A = false;
bool found_B = false;
foreach(TrackableBehaviour tb in tbs)
{
  string name = tb.TrackableName;
  if ("A".Equals (name) )
  {
    found_A = true;
    Debug.Log("Found target A");
  }

  else if ("B".Equals (name) ) 
  {
    found_B = true;
    Debug.Log("Found target B");
  }  
}

if (found_A && found_B)
{
  Debug.Log("Found targets A and B simultaneously tracked");  
}

I hope this helps.

 

Frame marker integration in UNITY

March 4, 2014 - 7:06am #6

Hi,

 

I have tried using these line of codes , but it never seem to be able to enter the "if statement". when I tried to put marker A and marker B together. 

StateManager sm = TrackerManager.Instance.GetStateManager();
IEnumerable <TrackableBehaviour> tbs = sm.GetActiveTrackableBehaviours();
 
foreach(TrackableBehaviour tb in tbs)
{
string name = tb.TrackableName;
 
  if(name=="A" && name=="B")
{
    Debug.Log(" Test A and B");
}
 
   Debug.Log(" Test : " + name);
}
 
Thank you.

Frame marker integration in UNITY

March 4, 2014 - 4:58am #5

Thank you very much for all the guides . It had helped me fix that error and I will try to play around with the logic with the code that you had gave me to implement the integration  =).

Frame marker integration in UNITY

March 4, 2014 - 4:51am #4

You need to import the necessary system packages, i.e.:

using System.Collections;

using System.Collections.Generics;

using System.Linq;

 

Frame marker integration in UNITY

March 4, 2014 - 4:35am #3

Thank you for your reply.

I had tried copying and pasting the codes that you had gave me but  I keep getting this error below .

Assets/Qualcomm Augmented Reality/Scripts/DefaultTrackableEventHandler.cs(29,17): error CS0308: The non-generic type `System.Collections.IEnumerable' cannot be used with the type arguments
 
it also highlight "IEnumerable <TrackableBehaviour>" red in colour and says the "IEnumerable does not exist in the current context"
 
Thank you.
 
 

Frame marker integration in UNITY

March 3, 2014 - 12:39pm #2

If you want to detect when 2 different markers are detected simultaneously, you can write a script that query the StateManager to get the currently detected markers, along the lines of this code:

StateManager sm = TrackerManager.Instance.GetStateManager(),

IEnumerable<TrackableBehaviour> trackables = sm.GetTrackableBehaviours();

once you have the list of trackables, you can iterate across them and check their names; if you detect that marker A and B are simultaneously in the list of trackables returned by the StateManager, you known that they are simultaneously being tracked.

Then, you can create a dynamic augmentation and add it to the scene. The rest is application logic.

 

Topic locked