Rumata
Rumata

Reputation: 1047

Vuforia: image sticks to the screen when the marker is lost

When Vuforia loses the marker, the 3D model which was "attached" to the marker is sticking to the screen. How to make it disappear if the marker tracking is lost?

Upvotes: 0

Views: 1043

Answers (1)

Everts
Everts

Reputation: 10701

Look for the script where you have:

public void OnTrackableStateChanged(
                                TrackableBehaviour.Status previousStatus,
                                TrackableBehaviour.Status newStatus)
{
    if (newStatus == TrackableBehaviour.Status.DETECTED ||
        newStatus == TrackableBehaviour.Status.TRACKED ||
        newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
    {
        OnTrackingFound();
    }
    else
    {
        OnTrackingLost();
    }
}

Then, implement OnTrackingLost:

void OnTrackingLost()
{
     model.SetActive(false);
}

Upvotes: 4

Related Questions