1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | /*============================================================================== Copyright (c) 2017 PTC Inc. All Rights Reserved. Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. Confidential and Proprietary - Protected under copyright and other laws. ==============================================================================*/ using UnityEngine; using Vuforia; /// <summary> /// A custom handler that implements the ITrackableEventHandler interface. /// </summary> public class mTrackableEventHandler_voice : MonoBehaviour, ITrackableEventHandler { #region PRIVATE_MEMBER_VARIABLES protected TrackableBehaviour mTrackableBehaviour; #endregion // PRIVATE_MEMBER_VARIABLES public GameObject AllObject; private bool OnlyOne=false; #region UNTIY_MONOBEHAVIOUR_METHODS protected virtual void Start() { mTrackableBehaviour = GetComponent<TrackableBehaviour>(); if (mTrackableBehaviour) mTrackableBehaviour.RegisterTrackableEventHandler(this); if (AllObject != null) AllObject.SetActive(false); } #endregion // UNTIY_MONOBEHAVIOUR_METHODS #region PUBLIC_METHODS /// <summary> /// Implementation of the ITrackableEventHandler function called when the /// tracking state changes. /// </summary> public void OnTrackableStateChanged( TrackableBehaviour.Status previousStatus, TrackableBehaviour.Status newStatus) { if (newStatus == TrackableBehaviour.Status.DETECTED || newStatus == TrackableBehaviour.Status.TRACKED || newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED) { Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found"); OnTrackingFound(); } else if (previousStatus == TrackableBehaviour.Status.TRACKED && newStatus == TrackableBehaviour.Status.NOT_FOUND) { Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " lost"); OnTrackingLost(); } else { // For combo of previousStatus=UNKNOWN + newStatus=UNKNOWN|NOT_FOUND // Vuforia is starting, but tracking has not been lost or found yet // Call OnTrackingLost() to hide the augmentations OnTrackingLost(); } } #endregion // PUBLIC_METHODS #region PRIVATE_METHODS protected virtual void OnTrackingFound() // 매 프레임 호출된다.... 그러니까 여기서 초기화하면안됨. { AllObject.SetActive (true); //if (robot_completeUI != null) // robot_completeUI.InitialSetup(); /* var rendererComponents = GetComponentsInChildren<Renderer>(true); var colliderComponents = GetComponentsInChildren<Collider>(true); var canvasComponents = GetComponentsInChildren<Canvas>(true); // Enable rendering: foreach (var component in rendererComponents) component.enabled = true; // Enable colliders: foreach (var component in colliderComponents) component.enabled = true; // Enable canvas': foreach (var component in canvasComponents) component.enabled = true; */ } protected virtual void OnTrackingLost() { AllObject.SetActive (false); //if (robot_completeUI != null) // robot_completeUI.ExitSetup(); /* var rendererComponents = GetComponentsInChildren<Renderer>(true); var colliderComponents = GetComponentsInChildren<Collider>(true); var canvasComponents = GetComponentsInChildren<Canvas>(true); // Disable rendering: foreach (var component in rendererComponents) component.enabled = false; // Disable colliders: foreach (var component in colliderComponents) component.enabled = false; // Disable canvas': foreach (var component in canvasComponents) component.enabled = false;*/ //isTacked = false; OnlyOne = false; } #endregion // PRIVATE_METHODS } | cs |
'🌍 Unity > VR, AR' 카테고리의 다른 글
OculusGo Mirror Mirroring 오큘러스 고 미러링 (0) | 2018.08.07 |
---|---|
Unity Oculus Go Build 유니티 오큘러스 고 빌드 (1) | 2018.06.21 |
Gear VR 개발자모드 : You are not developer (0) | 2018.03.28 |
Unity 2017.3 Vuforia Digital Eyewear 세팅관련. (0) | 2018.03.28 |
Unity 2017.3 + Vuforia + GearVR 빌드 (0) | 2018.03.28 |