Пример #1
0
        void Start()
        {
            if (GameObject.Find("CameraRig"))
            {
                mainCameraTransform = GameObject.Find("CameraRig").transform;
            }
            // Oculus Rig Setup
            else if (GameObject.Find("OVRCameraRig"))
            {
                mainCameraTransform = GameObject.Find("OVRCameraRig").transform;
            }

            leftHandAnchor  = GameObject.Find("LeftHandAnchor").transform;
            rightHandAnchor = GameObject.Find("RightHandAnchor").transform;

            leftControllerTranform  = GameObject.Find("LeftControllerAnchor").transform;
            rightControllerTranform = GameObject.Find("RightControllerAnchor").transform;

            player = FindObjectOfType <BNGPlayerController>();

            if (player)
            {
                // Use this to keep our head up high
                player.ElevateCameraIfNoHMDPresent = true;
                _originalPlayerYOffset             = player.ElevateCameraHeight;

                smoothLocomotion = player.GetComponentInChildren <SmoothLocomotion>(true);

                // initialize component if it's currently disabled
                if (smoothLocomotion != null && !smoothLocomotion.isActiveAndEnabled)
                {
                    smoothLocomotion.CheckControllerReferences();
                }

                playerTeleport = player.GetComponentInChildren <PlayerTeleport>(true);
                if (playerTeleport)
                {
                    priorStraightSetting = playerTeleport.ForceStraightArrow;
                }

                if (smoothLocomotion == null)
                {
                    Debug.Log("No Smooth Locomotion component found. Will not be able to use SmoothLocomotion without calling it manually.");
                }
                else if (smoothLocomotion.MoveAction == null)
                {
                    Debug.Log("Smooth Locomotion Move Action has not been assigned. Make sure to assign this in the inspector if you want to be able to move around using the VR Emulator.");
                }
            }
        }
Пример #2
0
        void Start()
        {
            mainCameraTransform = GameObject.Find("CameraRig").transform;
            leftHandAnchor      = GameObject.Find("LeftHandAnchor").transform;
            rightHandAnchor     = GameObject.Find("RightHandAnchor").transform;

            leftControllerTranform  = GameObject.Find("LeftControllerAnchor").transform;
            rightControllerTranform = GameObject.Find("RightControllerAnchor").transform;

            player = FindObjectOfType <BNGPlayerController>();

            if (player)
            {
                // Use this to keep our head up high
                player.ElevateCameraIfNoHMDPresent = true;
                _originalPlayerYOffset             = player.ElevateCameraHeight;

                smoothLocomotion = player.GetComponentInChildren <SmoothLocomotion>();

                if (smoothLocomotion == null)
                {
                    Debug.Log("No Smooth Locomotion component found. Will not be able to use SmoothLocomotion without calling it manually.");
                }
                else if (smoothLocomotion.MoveAction == null)
                {
                    Debug.Log("Smooth Locomotion Move Action has not been assigned. Make sure to assign this in the inspector if you want to be able to move around using the VR Emulator.");
                }
            }
        }
Пример #3
0
        void Start()
        {
            mainCameraTransform     = GameObject.Find("CameraRig").transform;
            leftControllerTranform  = GameObject.Find("LeftHandAnchor").transform;
            rightControllerTranform = GameObject.Find("RightHandAnchor").transform;

            player = FindObjectOfType <BNGPlayerController>();

            // Use this to keep our head up high
            player.ElevateCameraIfNoHMDPresent = true;
            _originalPlayerYOffset             = player.ElevateCameraHeight;

            smoothLocomotion = player.GetComponentInChildren <SmoothLocomotion>();
        }