public static bool GetBoolParameter(HVRHandSide side, string parameter) { var map = side == HVRHandSide.Left ? _leftBooleanParams : _rightBooleanParams; map.TryGetValue(parameter, out bool value); return(value); }
public static HVRButtonState GetButtonState(HVRHandSide side, HVRButtons button) { var map = side == HVRHandSide.Right ? _rightButtonStates : _leftButtonStates; map.TryGetValue(button, out var state); return(state); }
public static float GetFloatParameter(HVRHandSide side, string parameter) { var map = side == HVRHandSide.Left ? _leftFloatParams : _rightFloatParams; map.TryGetValue(parameter, out float value); return(value); }
public Vector3 GetPosePositionOffset(HVRHandSide side) { if (side == HVRHandSide.Left) { return(LeftPosePositionOffset); } return(RightPosePositionOffset); }
public Quaternion GetPoseRotation(HVRHandSide side) { if (side == HVRHandSide.Left) { return(transform.rotation * LeftPoseOffset); } return(transform.rotation * RightPoseOffset); }
public GameObject GetPoserHand(HVRHandSide side) { if (side == HVRHandSide.Left) { return(LeftHand); } return(RightHand); }
public Quaternion GetPoseRotationOffset(HVRHandSide side) { if (side == HVRHandSide.Left) { return(LeftPoseOffset); } return(RightPoseOffset); }
public InputDevice GetDevice(HVRHandSide side) { if (side == HVRHandSide.Left) { return(LeftDevice); } return(RightDevice); }
public bool GetForceGrabActive(HVRHandSide side) { if (!CanDistanceGrab) { return(false); } return(side == HVRHandSide.Left ? IsLeftForceGrabActive : IsRightForceGrabActive); }
public static HVRHandPoseData FromByteArray(byte[] bytes, HVRHandSide side) { var pose = new HVRHandPoseData(); using (var ms = new MemoryStream(bytes)) { using (var reader = new BinaryReader(ms)) { pose.Position = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); pose.Rotation = new Quaternion(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); var fingers = reader.ReadInt32(); for (var i = 0; i < fingers; i++) { var finger = new HVRPosableFingerData(); finger.Bones = new List <HVRPosableBoneData>(); switch (i) { case 0: pose.Thumb = finger; break; case 1: pose.Index = finger; break; case 2: pose.Middle = finger; break; case 3: pose.Ring = finger; break; case 4: pose.Pinky = finger; break; } var bones = reader.ReadInt32(); for (var j = 0; j < bones; j++) { var bone = new HVRPosableBoneData(); finger.Bones.Add(bone); bone.Position = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); bone.Rotation = new Quaternion(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); } } } } return(pose); }
public static void SetFloatParameter(HVRHandSide side, string parameter, float value) { var map = side == HVRHandSide.Left ? _leftFloatParams : _rightFloatParams; map[parameter] = value; }
public bool GetGrabActivated(HVRHandSide side) { return(side == HVRHandSide.Left ? IsLeftGrabActivated : IsRightGrabActivated); }
public static void SetButtonState(HVRHandSide side, HVRButtons button, HVRButtonState state) { var map = side == HVRHandSide.Right ? _rightButtonStates : _leftButtonStates; map[button] = state; }
public bool GetGripHoldActive(HVRHandSide side) { return(side == HVRHandSide.Left ? IsLeftGripHoldActive : IsRightGripHoldActive); }
public HVRController GetController(HVRHandSide side) { return(side == HVRHandSide.Left ? LeftController : RightController); }
private HVRController UpdateController(XRInputSystem sdk, InputDevice device, HVRHandSide side) { HVRInputSettings inputMap = null; Vector2 deadZone = Vector2.zero; HVRControllerType controllerType; //var hasTrackPad = side == HVRHandSide.Left ? LeftHasTrackPad : RightHasTrackPad; var wasNone = CurrentSDK == InputSDK.None; GetSDK(); if (CurrentSDK == InputSDK.Oculus) { #if !HVR_OCULUS Debug.LogWarning($"OVRInputs cannot be used because HVR_OCULUS define symbol is missing. Oculus Asset and the Hurricane Oculus Integration is required to use OVRInputs." + $"Falling back to XRInputs."); CurrentSDK = InputSDK.XRInput; #endif } if (wasNone && CurrentSDK != InputSDK.None) { Debug.Log($"InputSDK : {CurrentSDK}"); } switch (sdk) { case XRInputSystem.WMROpenVR: inputMap = WMROpenVRInputMap; deadZone = WMRDeadzone; controllerType = HVRControllerType.WMR; break; case XRInputSystem.ReverbG2: deadZone = WMRDeadzone; inputMap = WMRWithButtonsInputMap; controllerType = HVRControllerType.WMRButtons; break; case XRInputSystem.WMR: inputMap = WMRInputMap; deadZone = WMRDeadzone; controllerType = HVRControllerType.WMR; break; case XRInputSystem.OculusOpenVR: inputMap = OculusOpenVRInputMap; deadZone = OculusDeadzone; controllerType = HVRControllerType.Oculus; break; case XRInputSystem.Oculus: inputMap = OculusInputMap; deadZone = OculusDeadzone; controllerType = HVRControllerType.Oculus; break; case XRInputSystem.Vive: deadZone = ViveDeadzone; inputMap = ViveInputMap; controllerType = HVRControllerType.Vive; break; case XRInputSystem.Knuckles: deadZone = KnucklesDeadzone; inputMap = KnucklesInputMap; controllerType = HVRControllerType.Knuckles; break; case XRInputSystem.Cosmos: inputMap = CosmosInputMap; deadZone = CosmosDeadzone; controllerType = HVRControllerType.Cosmos; break; case XRInputSystem.None: inputMap = OculusInputMap; controllerType = HVRControllerType.None; break; default: inputMap = OculusInputMap; deadZone = OculusDeadzone; controllerType = HVRControllerType.Oculus; break; } if (!inputMap) { inputMap = OculusInputMap; } HVRController controller = null; if (side == HVRHandSide.Left) { if (LeftOculusController) { LeftOculusController.enabled = false; } if (LeftSteamController) { LeftSteamController.enabled = false; } if (LeftXRInputController) { LeftXRInputController.enabled = false; } if (LeftInputSystemController) { LeftInputSystemController.enabled = false; } } else { if (RightOculusController) { RightOculusController.enabled = false; } if (RightSteamController) { RightSteamController.enabled = false; } if (RightXRInputController) { RightXRInputController.enabled = false; } if (RightInputSystemController) { RightInputSystemController.enabled = false; } } switch (CurrentSDK) { case InputSDK.None: case InputSDK.XRInput: controller = side == HVRHandSide.Left ? LeftXRInputController : RightXRInputController; HVRXRInputController xrController = controller as HVRXRInputController; if (!controller) { xrController = gameObject.AddComponent <HVRXRInputController>(); controller = xrController; if (side == HVRHandSide.Left) { LeftXRInputController = controller; } else { RightXRInputController = controller; } } break; case InputSDK.Oculus: #if HVR_OCULUS controller = side == HVRHandSide.Left ? LeftOculusController : RightOculusController; if (!controller) { var oculusController = gameObject.AddComponent <HVROculusController>(); controller = oculusController; oculusController.OVRHaptics = OVRHaptics; if (side == HVRHandSide.Left) { LeftOculusController = controller; } else { RightOculusController = controller; } } #endif break; case InputSDK.SteamVR: #if HVR_STEAMVR controller = side == HVRHandSide.Left ? LeftSteamController : RightSteamController; if (!controller) { var steamController = gameObject.AddComponent <HVRSteamVRController>(); controller = steamController; if (side == HVRHandSide.Left) { LeftSteamController = steamController; } else { RightSteamController = steamController; } } #endif break; case InputSDK.InputSystem: #if ENABLE_INPUT_SYSTEM controller = side == HVRHandSide.Left ? LeftInputSystemController : RightInputSystemController; if (!controller) { var inputSystemController = gameObject.AddComponent <HVRInputSystemController>(); controller = inputSystemController; if (side == HVRHandSide.Left) { LeftInputSystemController = inputSystemController; } else { RightInputSystemController = inputSystemController; } } #endif break; default: throw new ArgumentOutOfRangeException(); } if (OverrideDeadzone) { deadZone = DeadzoneOverride; } if (controller != null) { controller.XRNode = side == HVRHandSide.Left ? XRNode.LeftHand : XRNode.RightHand; controller.ThumbstickDeadZone = deadZone; controller.Side = side; controller.InputMap = inputMap; controller.enabled = true; controller.ControllerType = controllerType; } controller.FingerSettings = FingerSettings; return(controller); }
public HVRButtonState GetTriggerGrabState(HVRHandSide side) { return(side == HVRHandSide.Left ? LeftTriggerGrabState : RightTriggerGrabState); }
public Quaternion GetJointRotationOffset(HVRHandSide side) { return(Quaternion.Inverse(JointOffset) * GetPoseRotationOffset(side)); }
public static void SetBoolParameter(HVRHandSide side, string parameter, bool value) { var map = side == HVRHandSide.Left ? _leftBooleanParams : _rightBooleanParams; map[parameter] = value; }
public Quaternion GetPoseWithJointRotation(HVRHandSide side) { return(transform.rotation * GetJointRotationOffset(side)); }
public HVRHandPoseData GetPose(HVRHandSide side) { return(side == HVRHandSide.Left ? LeftHand : RightHand); }