Log in or register to post comments

How to access augmented objects in Unity

September 27, 2016 - 11:06pm #1

I use an Image Target to display a picture via a RawImage (it is child to the Image Target, the hierarchy). I can detect at runtime when and what TrackableBehaviour is active, while the trackable has been detected and the picture is displayed on the screen.

What I would like to do is change the transparency of the picture by modifying the color.alpha attribute of the RawImage; I am using the same technique with success on the static, non AR pictures of the same kind.

The issue I have is that I could not find a way to access the RawImage object, from the active TrackableBehaviour.

Can anyone suggest how to find the augmented objects, in Vuforia?

I tried searching for GameObjects and RawImage as children and components of the active TrackableBehaviour, w/o success.

Also, the TrackableBehaviour.transform.childCount gives me 0, but I can experience that the RawImage is attached to the TrackableBehaviour, as it behaves as expected when the related trackable is tracked. I found this while trying to access the augmented RawImage via TrackableBehaviour.gameObject.transform.GetChild().gameObject

Thank you in advance for your help

Below is the piece of code for detecting the avtive / tracked TrackableBehaviour:

foreach (TrackableBehaviour atb in TrackerManager.Instance.GetStateManager().GetActiveTrackableBehaviours())

{

   if (atb.CurrentStatus == TrackableBehaviour.Status.TRACKED || atb.CurrentStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)

   {

      // here goes the code to access the RawImage

      ...

   }

}

Log in or register to post comments