Exemple #1
0
    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);
    }
Exemple #2
0
    protected override void Start()
    {
        base.Start();

        m_trackableBehaviour = GetComponent <ImageTargetBehaviour>();

        if (m_trackableBehaviour)
        {
            OnTrackingLost();

            m_trackableBehaviour.RegisterTrackableEventHandler(this);
        }
    }
Exemple #3
0
        } //END DestroyIfIncompatibleXRTechnology


        //--------------------------------------//
        public void RegisterTracker()
        //--------------------------------------//
        {

#if VUFORIA
            if( imageTargetBehaviour )
            {
                imageTargetBehaviour.RegisterTrackableEventHandler( this );
            }

            if( trackableBehaviour )
            {
                trackableBehaviour.RegisterTrackableEventHandler( this );
            }
#endif

        } //END RegisterTracker
Exemple #4
0
    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}");
    }
Exemple #5
0
 void Start()
 {
     ImageTarget.RegisterTrackableEventHandler(this);
 }