Beispiel #1
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();
            }
        }
Beispiel #2
0
        //

        private void Awake()
        {
            if (AutoSetFixedDeltaTime)
            {
                Time.fixedDeltaTime = NewtonVRExpectedDeltaTime;
            }

            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>();

            SetupIntegration();

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

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

            if (Integration != null)
            {
                Integration.Initialize(this);
            }

            if (OnInitialized != null)
            {
                OnInitialized.Invoke();
            }

            //cdr
            //adjust rift player starting height
            if ("Oculus" == VRSettings.loadedDeviceName)
            {
                transform.position = new Vector3(transform.position.x, transform.position.y + yAdjustRift, transform.position.z);
            }
            //
        }
Beispiel #3
0
        private void Awake()
        {
            if (HumanNaviConfig.Instance.configInfo.photonServerMachine || !this.GetComponent <PhotonView>().IsMine)
            {
                this.enabled = false;
                return;
            }

            if (AutoSetFixedDeltaTime)
            {
                Time.fixedDeltaTime = NewtonVRExpectedDeltaTime;
            }

            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>();

            SetupIntegration();

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

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

            if (Integration != null)
            {
                Integration.Initialize(this);
            }

            if (OnInitialized != null)
            {
                OnInitialized.Invoke();
            }
        }
Beispiel #4
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>();

            SetupIntegration();

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

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

            if (Integration != null)
            {
                Integration.Initialize(this);
            }

            if (OnInitialized != null)
            {
                OnInitialized.Invoke();
            }
        }
Beispiel #5
0
        private void Awake()
        {
            if (AutoSetFixedDeltaTime)
            {
                Time.fixedDeltaTime = NewtonVRExpectedDeltaTime;
            }

            Instances.Add(this);

            NVRInteractables.Initialize();

            if (Head == null)
            {
                Head = 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>();

            SetupIntegration();

            if (Hands.Count == 0)
            {
                Hands = new List <NVRHand> {
                    LeftHand, RightHand
                };

                foreach (NVRHand hand in Hands)
                {
                    hand.PreInitialize(this);
                    NVRInputDevice dev = null;
                    switch (CurrentIntegrationType)
                    {
                    case NVRSDKIntegrations.Oculus:
                        dev = hand.gameObject.AddComponent <NVROculusInputDevice>();
                        break;

                    case NVRSDKIntegrations.SteamVR:
                        dev = hand.gameObject.AddComponent <NVRSteamVRInputDevice>();
                        break;

                    case NVRSDKIntegrations.FallbackNonVR:
                    case NVRSDKIntegrations.None:
                    default:
                        Debug.LogError("[NewtonVR] Error: NVRPlayer.CurrentIntegration not setup.");
                        break;
                    }

                    dev.Initialize(hand);
                    hand.SetupInputDevice(dev);
                }
            }

            if (Integration != null)
            {
                Integration.Initialize(this);
            }

            if (OnInitialized != null)
            {
                OnInitialized.Invoke();
            }
        }