Log in or register to post comments

How to change Audio Source when multiple Image Targets are detected

March 19, 2017 - 5:34am #1

In my Vuforia Unity project, when I target an Image Target a sound is played. I want now to play a specific other sound if 2 targets are detected and another if 3 are detected.

I managed to list targeted Images by doing so in the ARCamera :

void Update () {

    // Get the Vuforia StateManager

    StateManager sm = TrackerManager.Instance.GetStateManager ();

    // Query the StateManager to retrieve the list of

    // currently 'active' trackables

    //(i.e. the ones currently being tracked by Vuforia)

    IEnumerable<TrackableBehaviour> activeTrackables = sm.GetActiveTrackableBehaviours ();

   // Iterate through the list of active trackables

    Debug.Log ("List of trackables currently active (tracked): ");

    foreach (TrackableBehaviour tb in activeTrackables) {

        Debug.Log("Trackable: " + tb.TrackableName);

    }

}

Do you have any idea how to implement what I want to do ?

Log in or register to post comments