private void Start() { tracker = GameObject.FindGameObjectWithTag("Target"); trackerBehaviour = tracker.GetComponent <ImageTargetBehaviour>(); renderers = GetComponentsInChildren <Renderer>(); this.transform.SetParent(tracker.transform); OverlayController.Instance.onStartOverlay.AddListener(this.destroyLevel); trackerBehaviour.RegisterTrackableEventHandler(this); OnTrackableStateChanged(TrackableBehaviour.Status.NO_POSE, trackerBehaviour.CurrentStatus); }
protected override void Start() { base.Start(); m_trackableBehaviour = GetComponent <ImageTargetBehaviour>(); if (m_trackableBehaviour) { OnTrackingLost(); m_trackableBehaviour.RegisterTrackableEventHandler(this); } }
} //END DestroyIfIncompatibleXRTechnology //--------------------------------------// public void RegisterTracker() //--------------------------------------// { #if VUFORIA if( imageTargetBehaviour ) { imageTargetBehaviour.RegisterTrackableEventHandler( this ); } if( trackableBehaviour ) { trackableBehaviour.RegisterTrackableEventHandler( this ); } #endif } //END RegisterTracker
void Awake() { #if UNITY_EDITOR activeConfig = editorConfig; #else #if WINDOWS_UWP activeConfig = UnityEngine.XR.WSA.HolographicSettings.IsDisplayOpaque ? wmrConfig : hololensConfig; #endif #if UNITY_IOS activeConfig = iosConfig; #endif #if UNITY_ANDROID activeConfig = androidConfig; #endif #endif if (!activeConfig.isEnabled) { DisableVuforia(); TurnOffInstructions(); } else { trackable = GetComponent <ImageTargetBehaviour>(); if (trackable != null) { trackable.RegisterTrackableEventHandler(this); } if (activeConfig.controlsCamera) { if (trackable == null) { VuforiaManager.Instance.WorldCenterMode = VuforiaARController.WorldCenterMode.FIRST_TARGET; } else { VuforiaManager.Instance.WorldCenterMode = VuforiaARController.WorldCenterMode.SPECIFIC_TARGET; VuforiaManager.Instance.WorldCenter = trackable; } VuforiaManager.Instance.WorldCenterMode = VuforiaARController.WorldCenterMode.SPECIFIC_TARGET; VuforiaConfiguration.Instance.DeviceTracker.TrackingMode = DeviceTracker.TRACKING_MODE.POSITIONAL; VuforiaConfiguration.Instance.DeviceTracker.AutoInitAndStartTracker = true; } else { VuforiaManager.Instance.WorldCenterMode = VuforiaARController.WorldCenterMode.DEVICE; VuforiaConfiguration.Instance.DeviceTracker.AutoInitAndStartTracker = false; } if (activeConfig.isTransparent) { VuforiaConfiguration.Instance.VideoBackground.VideoBackgroundEnabled = false; VuforiaConfiguration.Instance.DigitalEyewear.EyewearType = DigitalEyewearARController.EyewearType.OpticalSeeThrough; VuforiaConfiguration.Instance.DigitalEyewear.SeeThroughConfiguration = DigitalEyewearARController.SeeThroughConfiguration.HoloLens; } else { VuforiaConfiguration.Instance.VideoBackground.VideoBackgroundEnabled = true; VuforiaConfiguration.Instance.DigitalEyewear.EyewearType = DigitalEyewearARController.EyewearType.None; VuforiaConfiguration.Instance.DigitalEyewear.SeeThroughConfiguration = DigitalEyewearARController.SeeThroughConfiguration.Vuforia; } TurnOnInstructions(); } Debug.Log($"Vuforia Config: {activeConfig}"); }
void Start() { ImageTarget.RegisterTrackableEventHandler(this); }