Last active
February 27, 2018 16:10
-
-
Save oismaelash/7f07522334f2abca7b2d40307b46a95f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using Vuforia; | |
using UnityEngine.SceneManagement; | |
// Coloque esse script no GameObject ImageTarget | |
public class ActionDetectImageTarget: MonoBehaviour, ITrackableEventHandler | |
{ | |
private void Start() | |
{ | |
GetComponent<TrackableBehaviour>().RegisterTrackableEventHandler(this); | |
} | |
public void OnTrackableStateChanged( | |
TrackableBehaviour.Status previousStatus, | |
TrackableBehaviour.Status newStatus) | |
{ | |
if (newStatus == TrackableBehaviour.Status.DETECTED || | |
newStatus == TrackableBehaviour.Status.TRACKED || | |
newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED) | |
{ | |
// Ação se o Vuforia rastreou e detectou o Image Target | |
SceneManager.LoadScene("NomeDaSuaCena"); // Carrega uma cena | |
} | |
else if (previousStatus == TrackableBehaviour.Status.TRACKED && | |
newStatus == TrackableBehaviour.Status.NOT_FOUND) | |
{ | |
// Ação se o Vuforia perdeu o rastreamento e detecção do Image Target | |
} | |
else | |
{ | |
// Ação se o Vuforia perdeu o rastreamento e detecção do Image Target | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment