Skip to content

Vive Input Utiltiy v1.6.0

Compare
Choose a tag to compare
@lawwong lawwong released this 31 Mar 06:29
· 1042 commits to master since this release

Changes for v1.6.0:

  • New ViveRole System

    • ViveRole is a mapping system that relate logic roles to OpenVR device indices.
    • Each role has their own auto-mapping logic, and binding API allow user to customize the relation.
      • Both mapping (role, device index) binding (role, device serial number) are one-on-one relation
      • When a device serial number is binding to a role, it means that role is always mapping to the specific device
      • If the bound device is disconnected, the bound role will not mapping to any device index (invalid).
    • Currently there are 4 built-in roles:
      • DeviceRole: role that mapping to all 16 devices, ordered exactly same as device index.
      • HandRole: role related to standard Vive controllers, with basic RightHand/LeftHand recognition.
      • TrackerRole: role related to Vive trackers, first conntected tracker will be mapping to Tracker1.
      • BodyRole: role related to devices that tracking human limbs.
    • Creating custom role in an instant by adding ViveRoleEnumAttribute to your enum type
    • Customizing auto-mapping logic by implementing ViveRoleHandler<EnumType> and call ViveRole.AssignMapHandler()
  • New query APIs that accept any ViveRoles, ex.

    • Use ViveRole.GetDeviceIndexEx(TrackerRole.Tracker1) to get tracker's device index.
    • Use VivePose.GetPoseEx(TrackerRole.Tracker1) to get tracker's tracking data
    • Use ViveInput.GetPressEx(TrackerRole.Tracker1, ControllerButton.Trigger) to get tracker's trigger event.
    • Use ViveInput.AddListenerEx(TrackerRole.Tracker1, ControllerButton.Trigger, ButtonEventType.Press) to listen tracker's trigger event.
  • New sample scene "RoleBindingExample"

    • This sample scene demonstrate how to bind device a role and save/load those bindings
  • New ViveRoleBindingsHelper helper component

    • Adding this component to scene to auto-load bindings.
    • Call function SaveRoleBindings(filePath) to save bindings manually.
    • Call function LoadRoleBindings(filePath) to load bindings manually.
  • New RenderModelHook helper component

    • This script creates and handles SteamVR_RenderModel, so you can show render model specified by ViveRole insdead of device index.
  • New ExternalCameraHook helper component

    • This script creates and handles SteamVR_ExternalCamera, and let camera tracking device specified by ViveRole insdead of device index.
    • Setup step-by-step
      1. Add a file called externalcamera.cfg in the root of your project. (the config file sample can be found here)
      2. Add ExternalCameraHook component into your scene. (don't remove the auto-generated SteamVR_Render component)
      3. Select ExternalCameraHook gameobject and set the device role in inspector. (or set in script, ex. ExternalCameraHook.viveRole.SetEx(TrackerRole.Tracker1))

        If you are using 3rd Vive standard controller as external camera, set to HandRole.Controller3 (recommended)
        If you are using ViveTracker as external camera, set to TrackerRole.Tracker1 (recommended)

      4. (Optional) Bind the external camera tracking device to the role
      5. Open "RoleBindingExample" scene
      6. Scan the specific device (for external camera)
      7. Bind to the specific role (ex. HandRole.Controller3 or TrackerRole.Tracker1)
      8. Save bindings
      9. Back to your project scene
      10. Add ViveRoleBindingsHelper component into your scene. (to load bindings automatically)
      11. Now external camera should always tracking at the device you wanted.