コード例 #1
0
        void LoadedDevice()
        {
            if (XRDevice.model.Contains("Google"))
            {
                if (XRSettings.loadedDeviceName.Contains("carboard"))
                {
                    //TODO: Cardboard
                    loadedDevice = XR_Enum.Device.None;
                }
            }
            else if (XRDevice.model.Contains("Samsung"))
            {
                loadedDevice = XR_Enum.Device.GearVR;
            }
            else if (XRDevice.model.Contains("Vive"))
            {
                loadedDevice = XR_Enum.Device.Vive;
            }
            else if (XRDevice.model.Contains("Rift"))
            {
                loadedDevice = XR_Enum.Device.Oculus;
            }
            else
            {
                loadedDevice = XR_Enum.Device.None;
            }

            Debug.Log("VR Device Model Name: " + XRDevice.model);
            Debug.Log("Loaded Device Name: " + XRSettings.loadedDeviceName);
            Debug.Log("loadedDevice: " + loadedDevice);
        }
コード例 #2
0
        public ControllerModel GetControllerMode(XR_Enum.Device device, XR_Enum.Hand hand)
        {
            if (controllerModels == null)
            {
                return(null);
            }

            for (int i = 0; i < controllerModels.Length; i++)
            {
                if (controllerModels[i].device == device && controllerModels[i].hand == hand)
                {
                    return(controllerModels[i]);
                }
            }

            return(null);
        }
コード例 #3
0
        internal virtual void InitInputDevice(InputDevice inputDevice)
        {
            device = inputDevice;

            gameObject.name = device.name;

            if (device.role == InputDeviceRole.LeftHanded)
            {
                HandType = XR_Enum.Hand.LEFT;
                transform.SetParent(SDKSetup.GetHand(XR_Enum.Hand.LEFT).transform);
            }
            else if (device.role == InputDeviceRole.RightHanded)
            {
                HandType = XR_Enum.Hand.RIGHT;
                transform.SetParent(SDKSetup.GetHand(XR_Enum.Hand.RIGHT).transform);
            }
            transform.ResetTransform();

            deviceType = SDKSetup.GetDevice();

            InitKeyBindingData();
            SpawnControllerModel();
        }