Log in or register to post comments

Wich trackable I'm seeing with the camera

September 11, 2012 - 5:58pm #1

Hello, I've been breaking my head for the last hours trying to do a script with a GUI attached to the ARCamera, this GUI just have one button that, when clicked, triggers a Debug.Log that prints the name of the trackable that the camera is seeing in that moment or a message that it is not seeing a trackable at that moment. 

I've already tried modifing the DefaultTrackableEventHandler but is not working correctly, because it is attached to the Camera and the two ImageTargets. 

Do you know how I can manage this in an easy way? If you need another information just ask. I'm currently working in the sample project with two imagetargets (chip and stones) and each one have a different model. The models reder just fine and everything works fine. Just that little part.

Wich trackable I'm seeing with the camera

September 12, 2012 - 2:19pm #4

It worked really good !!!! Thanks :)

Wich trackable I'm seeing with the camera

September 12, 2012 - 2:19pm #3

It worked really good !!!! Thanks :)

Wich trackable I'm seeing with the camera

September 12, 2012 - 11:52am #2

The easiest way to accomplish this will be to expose a public variable on your GUI script and to define this from the trackable's event handler.

So if your GUI script is named TrackableLogger and it's attached to your ARCamera, and the variable is named activeTrackableName, then you can do the following in the OnTrackingFound method of your your event handler..

 

GameObject arcam = GameObject.Find("ARCamera");

arcam.GetComponent<TrackableLogger>().activeTrackableName = mTrackableBehaviour.TrackableName;

Then when you want to log the active trackable name from the TrackableLogger script, you'd use something like..

 

void OnGUI(){

 

   if( GUILayout.Button("Log Active Trackable") ){

     Debug.Log( activeTrackableName );

  }

 

}

Log in or register to post comments