Search Unity

Documentation claims VR Controllers work with EventSystem?!

Discussion in 'AR/VR (XR) Discussion' started by techmage, Feb 7, 2018.

  1. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,133
    So in the documentation here:
    https://docs.unity3d.com/Manual/OpenVRControllers.html

    It says:
    • The Event System generates Input Touch events for the triggers on HTC Vive controllers when the user begins squeezing the trigger.
    • The Event System generates Input Touch events for the triggers on Oculus Touch and Valve Knuckles controllers when Unity Input detects a touch - no trigger squeeze is necessary.
    What?

    The wording of this seems to make me think there is someway in the Unity API to get the VR controllers to output UnityEvents. Is this true? How do I do this?
     
  2. solidearthvr

    solidearthvr

    Joined:
    Jan 23, 2017
    Posts:
    50
    A quick way to get event info is to add the SteamVR_TrackedController component to the left and right controllers under the [CameraRig]. You can then create a script that subscribes to the TriggerClicked event from within this component.
     
  3. bradweiers

    bradweiers

    Joined:
    Nov 3, 2015
    Posts:
    59
    The EventSystem in this context is the event system behind the UI system, not UnityEvents.
     
  4. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,133
    UnityEvents was the wrong term to use. I was referring to the contents of UnityEngine.EventSystems and the event interfaces, IPointerDown, IButtonDown etc.

    Is there a way to get an XR controller to generate those via built-in means?
     
  5. StephenHodgson-Valorem

    StephenHodgson-Valorem

    Joined:
    Mar 8, 2017
    Posts:
    148
    > The EventSystem in this context is the event system behind the UI system, not UnityEvents.

    That's not entirely true, the Mixed Reality Toolkit for example extends the EventSystem to also handle raising input to other GameObjects. We actually extend this system quite a bit with some pretty nice results.