Skip to content

Improved SteamVR driver for Leap Motion controller

Notifications You must be signed in to change notification settings

ShootingKing-AM/driver_leap

 
 

Repository files navigation

Leap Motion Controller Emulation - SteamVR Driver

Build status Release

A Fork with updated vendor libraries and extended features.

Contents

Installation

for users

Default "SteamVR_folder" Location: C:\Program Files (x86)\Steam\steamapps\common\SteamVR
Default "Steam_folder" Location: C:\Program Files (x86)\Steam
  • Install latest Leap Motion Orion Beta
  • You should already have Steam and SteamVR installed.
  • Create leap folder in <SteamVR_folder>/drivers
  • Grab latest release archive (.zip) for your platform
  • Extract archive to <SteamVR_folder>/drivers/leap
  • Edit steamvr configuration in <Steam_folder>/config/steamvr.vrsettings file
    • If you are using a HMD already,
      • Add below line in section 'steamvr'
      "activateMultipleDrivers": true,
    • If you want to try without HMD,
      • Add following lines in 'steamvr' section, and
      "activateMultipleDrivers": true,
      "requireHmd" : false,
      "forcedDriver" : "null"
      • Add another section 'driver_null', if it dosen't exist already (you can change renderHeight/Width and windowHeight/Width below)
      "driver_null" : {
        "displayFrequency" : 60,
        "enable" : true,
        "modelNumber" : "Null Model Number",
        "renderHeight" : 1080,
        "renderWidth" : 1920,
        "secondsFromVsyncToPhotons" : 0.01111111,
        "serialNumber" : "Null Serial Number",
        "windowHeight" : 1080,
        "windowWidth" : 1920,
        "windowX" : 0,
        "windowY" : 0
      }

Driver Control configuration and Inputs

Driver can emulate HTC Vive controllers and Valve Index controllers with skeletal animation. Works in both desktop and HMD orientations of leap controller. Which controller to emulate and in what orientation leap controller is being used in, can be adjusted by editing settings.xml in <SteamVR_folder>/drivers/leap/resources folder.

There are more configurable restrictions, such as global input, trackpad, trigger, grip and etc. in settings.xml. Check wiki page for few offset settings contributed by users. Controls are changed by "Game Profiles" that are enabled automatically when respective game is started from Steam.

Available Hotkeys in NumLock active state:

  • Ctrl-P: Enable/disable right hand controller.
  • Ctrl-O: Enable/disable left hand controller.
  • Ctrl-\ (or Ctrl-|) Reload configuration.

Controller Emulation

Real VR controllers give button touches, button presses, hand orientation feedbacks to SteamVR, which are then relayed to Game applications for different actions in-game. This driver emulates such feedback via gesture recognition by Leap motion controller and provides it to SteamVR. Preconfigured gestures are specified below for respective controller types and game profiles.

HTC Vive

Game profiles:

  • default
    Controls list:
    • Application menu - hand with palm directed towards face
    • Touchpad
      • Touchpad press - thumb press
      • Touchpad circle - index finger of one hand directed towards other hand's palm
    • System menu - T-shape with two hands
    • Trigger - bending of the index finger
    • Grip - grab gesture
  • vrchat - profile for VRChat. Control restrictions are ignored.
    Controls list:
    • Gun - corresponding hand gesture
    • V-shape - corresponding hand gesture
    • Point - corresponding hand gesture
    • Rock out - corresponding hand gesture
    • Thumbs up - corresponding hand gesture
    • Spread hand - corresponding hand gesture. Also corresponds to grip button.
    • Trigger - grab gesture
    • Application menu - T-shape with two hands

Valve Index

Game profiles:

  • default
    Controls list:
    • Button A - touching of thumb and middle fingertips
    • Button B - touching of thumb and pinky fingertips
    • Touchpad
      • Touchpad - thumb press
      • Touchpad cycle - index finger of one hand directed towards other hand's palm
    • Thumbstick
      • Thumbstick press - touching of thumb fingertip of one hand to index fingertip of other hand
      • Thumbstick direction - arrow keys for left hand, Num2/8/4/6 keys for right hand; available when NumLock is active
    • Trigger - bending of the index finger
    • Grip - bending of middle, ring and pinky fingers
    • System button - T-shape with two hands
  • vrchat - profile for VRChat. Note: game gestures are not implemented due to finger tracking, grip input profile should be used.
    Controls list:
    • Trigger - bending of the index finger
    • Grip - grab gesture
    • Game menu - T-shape with two hands

Runtime Configuration

Sometimes it is possible that the Real Hand is not exactly represented in VR Application, so it is required adjust/offset in x,y,z directions. Dynamic Offsetting for Left,Right hand spatial and rotational offsets can be done through special keys, as follows,

SCL - Scroll Lock: On NML - Num Lock: On Caps - Caps Lock: On

  • LeftHand Spatial Offset Increment(+ve)

    • x = SCL + U
    • y = SCL + I
    • z = SCL + O
  • LeftHand Rotational Offset Increment(+ve)

    • x = SCL + NML + U
    • y = SCL + NML + I
    • z = SCL + NML + O
    • w = SCL + NML + P
  • RightHand Spatial Offset Increment(+ve)

    • x = Caps + SCL + U
    • y = Caps + SCL + I
    • z = Caps + SCL + O
  • RightHand Rotational Offset Increment(+ve)

    • x = Caps + SCL + NML + U
    • y = Caps + SCL + NML + I
    • z = Caps + SCL + NML + O
    • w = Caps + SCL + NML + P
  • For Negative increments(decrements(-ve)), SHIFT key should also be used along with above combinations.

  • Saving offsets to Config file : NML + Caps + SCL + SHIFT + G

  • Resetting offsets to default values : NML + Caps+ SCL + R

Troubleshooting

Sometimes installation of base project driver doesn't register driver folder for SteamVR. To manually add it:

  • Open console as administrator in <SteamVR_folder>/bin/[win32 or win64] and execute command:
    vrpathreg adddriver "path_to_leap_folder"
    
    With default leap folder path, the command should look something like:
    vrpathreg adddriver "C:\Program Files (x86)\Steam\steamapps\common\SteamVR\drivers\leap"
    
  • Check if driver folder is added by calling vrpathreg without any arguments.
  • Open <Steam_folder>/config/steamvr.vrsettings file and add line in steamvr section:
    "activateMultipleDrivers": true,
  • You can also check if the driver emulated controllers are registered with SteamVR by using the command vrcmd in the same bin folder as above.

Building

for developers

  • Open 'driver_leap.sln' solution in Visual Studio 2013 and Visual Studio 2017 (Other versions of Visual Studio have to build their own vendor libraries using CMake and retarget solution)
  • Build the solution as per your platform. Output files for:
    • x64 - in bin/win64, in solution folder.
    • x86 - in bin/win32, in solution folder.
  • Copy the following built files to <SteamVR_folder>/drivers/leap/bin/<your_platform>:
    • driver_leap.dll
    • gesture_checker.exe
    • leap_monitor.exe
      Note: There are post-build events for projects to copy build files directly to SteamVR driver folder that can be enabled manually.
  • Copy additional shared vendor libraries from solution folder to <SteamVR_folder>/drivers/leap/bin/<your_platform>:
    • vendor/LeapSDK/bin/<your_platform>/LeapC.dll
    • vendor/openvr/bin/<your_platform>/openvr_api.dll
  • Copy resources folder from solution root to driver's leap folder (<SteamVR_folder>/drivers/leap).
  • For runtime debugging and breakpointing attach MSVS debugger to vrserver.exe process.

About

Improved SteamVR driver for Leap Motion controller

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 98.8%
  • C 1.2%