/// <summary> /// Get a float value representing how much a button has been pressed from the control scheme /// </summary> /// <param name="h">Which hand is the axis on</param> /// <param name="b">Which button is being pressed</param> /// <returns>A float from 0-1 indicating how much the input has been pressed</returns> public override float GetAxis(Hand h, Button b) { OVRInput.Controller hand = (h == Hand.Left) ? OVRInput.Controller.LTouch : OVRInput.Controller.RTouch; //maps hands to OVRInput OVRInput.Axis1D axis = AxisMap(b); //maps abstract buttons to OVR Axis if (axis != OVRInput.Axis1D.None) { return(OVRInput.Get(axis, hand)); //null check to make sure an axis exists } return(GetButton(h, b) ? 1f : 0f); //if no axis exists, then just get a bool value and return 0 or 1 }
private void Awake() { if (hand == Hand.Left) { this.button = OVRInput.Axis1D.PrimaryIndexTrigger; } else { this.button = OVRInput.Axis1D.SecondaryIndexTrigger; } grabbing = false; }
void CheckAnalog1DAndOutputText(OVRInput.Axis1D data) { if (OVRInput.Get(data) > 0) { tm2.text += "<color=#ff0000>"; } else { tm2.text += "<color=#ffffff>"; } tm2.text += data.ToString() + ":" + OVRInput.Get(data).ToString() + "\n"; tm2.text += "</color>"; }
private bool UpdateTrigger(OvrAvatarPhysicsHand hand, OVRInput.Axis1D input) { var hand_trigger = OVRInput.Get(input); if (hand_trigger > 0) { hand.ActivateColliders(); return(true); } else { hand.DeactivateColliders(); return(false); } }
/// <summary> /// <para>Toggles the Oculus Axis defined by the <strong>axisMask</strong> parameter so as to associate the Input Axis with an Oculus Touch Input Axis.</para> /// <innovasys:widget type="Caution Box" layout="block" xmlns:innovasys="http://www.innovasys.com/widgets"> /// <innovasys:widgetproperty layout="block" name="Content"> /// <strong>Be careful!</strong> Oculus devices do not use virtual inputs or virtual mappings managed /// through the <see cref="!:https://docs.unity3d.com/Manual/class-InputManager.html">Unity Input Manager</see>. Instead, they are accessed /// directly through the <see cref="!:https://developer.oculus.com/downloads/game-engines/1.5.0/Oculus_Utilities_for_Unity_5/">Oculus /// Utilities for Unity</see>.</innovasys:widgetproperty> /// </innovasys:widget> /// </summary> /// <param name="axisMask">An <see cref="OVRInput.Axis1D" /> enum value which represents a bitmask corresponding to one of the hard-coded 1-dimensional input axes supported by Oculus devices.</param> public void toggleAxis1D(OVRInput.Axis1D axisMask) { if (axisMask != OVRInput.Axis1D.None) { _previousAxis1D = this.axis1D; _previousAxis2D = this.axis2D; _axis2D = OVRInput.Axis2D.None; _axis1D = axisMask; } else { _previousAxis1D = this.axis1D; _axis1D = OVRInput.Axis1D.None; _axis2D = _previousAxis2D; } }
// Use this for initialization void Start() { ObjectGrab = null; PosibleObjectGrab = null; HandsParent = transform.parent.GetComponent <scr_HandsControl>(); Hand = AnimatorHand.gameObject; if (MyController == OVRInput.Controller.RTouch) { IsRight = true; GrabButton = OVRInput.Axis1D.SecondaryHandTrigger; AcctionButton = OVRInput.Axis1D.SecondaryIndexTrigger; } else { IsRight = false; GrabButton = OVRInput.Axis1D.PrimaryHandTrigger; AcctionButton = OVRInput.Axis1D.PrimaryIndexTrigger; } }
// Token: 0x06005666 RID: 22118 RVA: 0x001DBB80 File Offset: 0x001D9F80 private float GetAxis1D(OVRInput.Axis1D axis, OVRInput.Controller controller) { EVRButtonId buttonId; if (axis != OVRInput.Axis1D.PrimaryHandTrigger) { if (axis != OVRInput.Axis1D.PrimaryIndexTrigger) { buttonId = EVRButtonId.k_EButton_Max; } else { buttonId = EVRButtonId.k_EButton_Axis1; } } else { buttonId = EVRButtonId.k_EButton_Axis2; } return(this.GetSteamController(controller).GetAxis(buttonId).x); }
private bool GetOVRButtonDown(SVControllerType controller, SVInputButton button) { bool isRight = (controller == SVControllerType.SVController_Right); OVRInput.Controller ovrController = (isRight ? OVRInput.Controller.RTouch : OVRInput.Controller.LTouch); switch (button) { // Buttons case SVInputButton.SVButton_A: case SVInputButton.SVButton_B: case SVInputButton.SVButton_System: case SVInputButton.SVButton_Thumbstick_Press: return(OVRInput.Get(GetOVRButtonMapping(button), ovrController)); // 2D Axis case SVInputButton.SVButton_Thumbstick_Down: case SVInputButton.SVButton_Thumbstick_Left: case SVInputButton.SVButton_Thumbstick_Right: case SVInputButton.SVButton_Thumbstick_Up: { OVRInput.Axis2D axis2D = OVRInput.Axis2D.PrimaryThumbstick; Vector2 vec = OVRInput.Get(axis2D, ovrController); if (button == SVInputButton.SVButton_Thumbstick_Down) { return(vec.y < -0.75); } else if (button == SVInputButton.SVButton_Thumbstick_Up) { return(vec.y > 0.75); } else if (button == SVInputButton.SVButton_Thumbstick_Left) { return(vec.x < -0.75); } else if (button == SVInputButton.SVButton_Thumbstick_Right) { return(vec.x > 0.75); } return(false); } // 1D Axis case SVInputButton.SVButton_Trigger: case SVInputButton.SVButton_Grip: { OVRInput.Axis1D axis = OVRInput.Axis1D.PrimaryIndexTrigger; if (button == SVInputButton.SVButton_Trigger) { axis = OVRInput.Axis1D.PrimaryIndexTrigger; } else if (button == SVInputButton.SVButton_Grip) { axis = OVRInput.Axis1D.PrimaryHandTrigger; } return(OVRInput.Get(axis, ovrController) > 0.75f); } default: return(false); } }
public RiftInputAxis(OVRInput.Axis1D a, OVRInput.Controller c) { axis = a; controller = c; }
void RegisterAction(string key, OVRInput.Axis1D a, OVRInput.Controller c) { axes.Add(key, new RiftInputAxis(a, c)); }
public float GetAxis(OVRInput.Axis1D axis) { return(OVRInput.Get(axis, controller)); }
// Update is called once per frame void Update() { if (this.GetComponent <OVRGrabbable>().isGrabbed) { InputDevice leftController = InputDevices.GetDeviceAtXRNode(XRNode.LeftHand); InputDevice rightController = InputDevices.GetDeviceAtXRNode(XRNode.RightHand); OVRInput.Axis1D activeController = OVRInput.Axis1D.SecondaryIndexTrigger; OVRGrabber hand = this.gameObject.GetComponent <OVRGrabbable>().grabbedBy; if (hand.name == "LeftHandAnchor") { activeController = OVRInput.Axis1D.PrimaryIndexTrigger; } else if (hand.name == "RightHandAnchor") { activeController = OVRInput.Axis1D.SecondaryIndexTrigger; } //if (OVRInput.Get(OVRInput.Button.PrimaryHandTrigger, activeController)) if (OVRInput.Get(activeController) == 1) { if (bucketCounter > 0 && !buttonDown) { HapticEvent(0.5f); buttonDown = true; bucketCounter -= 1; switch (bucketCounter) { case 1: transform.Find("bucket filled2").gameObject.SetActive(false); transform.Find("bucket filled1").gameObject.SetActive(true); break; case 2: transform.Find("bucket filled3").gameObject.SetActive(false); transform.Find("bucket filled2").gameObject.SetActive(true); break; case 3: transform.Find("bucket filled4").gameObject.SetActive(false); transform.Find("bucket filled3").gameObject.SetActive(true); break; case 4: transform.Find("bucket filled5").gameObject.SetActive(false); transform.Find("bucket filled4").gameObject.SetActive(true); break; case 0: transform.Find("bucket filled1").gameObject.SetActive(false); break; default: break; } Transform cube = Instantiate(cubePrefab, this.transform.position, Quaternion.identity); audio.clip = empty; audio.Play(); // cube.gameObject.GetComponent<SandCube>().hasNotBeenGrabbed = false; } } if (OVRInput.Get(OVRInput.Axis1D.SecondaryIndexTrigger) == 0) { buttonDown = false; } } }
public OculusController(OVRInput.Controller aController, OVRInput.Axis1D aAxis = OVRInput.Axis1D.PrimaryHandTrigger) { _controller = aController; _axis = aAxis; }
public virtual void OnTriggerAnalogValue(OVRInput.Axis1D type, float axis) { }