예제 #1
0
        private void SetupIntegration(bool logOutput = true)
        {
            CurrentIntegrationType = DetermineCurrentIntegration(logOutput);

            if (CurrentIntegrationType == NVRSDKIntegrations.Oculus)
            {
                Integration = new NVROculusIntegration();
            }
            else if (CurrentIntegrationType == NVRSDKIntegrations.SteamVR)
            {
                Integration = new NVRSteamVRIntegration();
            }
            else if (CurrentIntegrationType == NVRSDKIntegrations.FallbackNonVR)
            {
                if (logOutput)
                {
                    Debug.LogError("[NewtonVR] Fallback non-vr not yet implemented.");
                }
            }
            else
            {
                if (logOutput)
                {
                    Debug.LogError("[NewtonVR] Critical Error: Oculus / SteamVR not setup properly or no headset found.");
                }
            }
        }
예제 #2
0
        private void Awake()
        {
            Instances.Add(this);

            NVRInteractables.Initialize();

            if (Head == null)
            {
                Head = this.GetComponentInChildren <NVRHead>();
            }
            Head.Initialize();

            if (LeftHand == null || RightHand == null)
            {
                Debug.LogError("[FATAL ERROR] Please set the left and right hand to a nvrhands.");
            }

            ColliderToHandMapping = new Dictionary <Collider, NVRHand>();

            DetermineCurrentIntegration();

            if (CurrentIntegrationType == NVRSDKIntegrations.Oculus)
            {
                Integration = this.gameObject.AddComponent <NVROculusIntegration>();
            }
            else if (CurrentIntegrationType == NVRSDKIntegrations.SteamVR)
            {
                Integration = this.gameObject.AddComponent <NVRSteamVRIntegration>();
            }
            else if (CurrentIntegrationType == NVRSDKIntegrations.FallbackNonVR)
            {
                Debug.LogError("[NewtonVR] Fallback non-vr not yet implemented.");
                return;
            }
            else
            {
                Debug.LogError("[NewtonVR] Critical Error: Oculus / SteamVR not setup properly or no headset found.");
                return;
            }


            if (Hands == null || Hands.Length == 0)
            {
                Hands = new NVRHand[] { LeftHand, RightHand };

                for (int index = 0; index < Hands.Length; index++)
                {
                    Hands[index].PreInitialize(this);
                }
            }

            Integration.Initialize(this);

            if (OnInitialized != null)
            {
                OnInitialized.Invoke();
            }
        }
예제 #3
0
        private void SetupIntegration(bool logOutput = true)
        {
            CurrentIntegrationType = DetermineCurrentIntegration(logOutput);

            if (CurrentIntegrationType == NVRSDKIntegrations.Oculus)
            {
                Integration = new NVROculusIntegration();
            }
            else if (CurrentIntegrationType == NVRSDKIntegrations.Gear)
            {
                Integration = new NVRGearIntegration();
            }
            else if (CurrentIntegrationType == NVRSDKIntegrations.SteamVR)
            {
                Integration = new NVRSteamVRIntegration();
            }
            else if (CurrentIntegrationType == NVRSDKIntegrations.Daydream)
            {
                Integration = new NVRDaydreamIntegration();
            }
            else if (CurrentIntegrationType == NVRSDKIntegrations.FallbackNonVR)
            {
                if (logOutput == true)
                {
                    Debug.LogError("[NewtonVR] Fallback non-vr not yet implemented.");
                }
                return;
            }
            else
            {
                if (logOutput == true)
                {
#if !UNITY_EDITOR || NVR_Oculus
                    Debug.LogError("[NewtonVR] Critical Error: Oculus / SteamVR not setup properly or no headset found.");
#endif
                }
                return;
            }
        }