LibreVR / Revive

Play Oculus-exclusive games on the HTC Vive or Valve Index, scroll down for downloads and installation instructions.
Other
3.62k stars 332 forks source link

Custom OpenVR Controller #576

Closed dashingstag closed 7 years ago

dashingstag commented 7 years ago

Is it possible to use a custom openvr controller to play oculus games using Revive?

Is there an additional mapping I need to do in my OpenVR driver for it to simulate a oculus touch? I currently send openvr controller updates so it works for steam games. So far it seems that only my trigger,system,grip, buttons work. How can I map the other buttons since openvr only gives the following?

        k_EButton_System            = 0,
    k_EButton_ApplicationMenu           = 1,
    k_EButton_Grip              = 2,
    k_EButton_DPad_Left         = 3,
    k_EButton_DPad_Up           = 4,
    k_EButton_DPad_Right                = 5,
    k_EButton_DPad_Down         = 6,
    k_EButton_A                 = 7,

    k_EButton_ProximitySensor             = 31,

    k_EButton_Axis0             = 32,
    k_EButton_Axis1             = 33,
    k_EButton_Axis2             = 34,
    k_EButton_Axis3             = 35,
    k_EButton_Axis4             = 36,

    // aliases for well known controllers
    k_EButton_SteamVR_Touchpad  = k_EButton_Axis0,
    k_EButton_SteamVR_Trigger   = k_EButton_Axis1,

    k_EButton_Dashboard_Back    = k_EButton_Grip,

    k_EButton_Max               = 64

I have taken a look at InputManager.cpp in Revive source but think I need a little guidance here on how revive simulates vive(or is it openvr) button mappings.

In addition it seems like my custom HMD openvr driver is working while using Revive.

dashingstag commented 7 years ago

My thoughts is I should overwrite the revive dll with a new InputDevice and pushback the device into m_InputDevices? Is this the best way? or can I interface this through the openvr driver?

CrossVR commented 7 years ago

@dashingstag Revive uses the k_EButton_SteamVR_Touchpad to simulate buttons, Revive queries where the touchpad is touched and uses that to determine which button should be pressed if the touchpad is pressed. Here's the mapping:

mapping

Also, swiping across the touchpad activates the thumbstick.

CrossVR commented 7 years ago

By the way, if you are writing a custom OpenVR driver for a custom tracked controller that does The necessary extra buttons we could look into mapping those through the unused buttons.

The DPad and Button A are unused on the Vive controller, but offer more than enough enums to map these buttons. So if you could map these to your physical buttons I could include them in Revive.

If you also have a physical thumbstick you could offer an axis with the k_eControllerAxis_Joystick type and I could have Revive look for axes with that type to use for the thumbstick.

dashingstag commented 7 years ago

Oh nice I got my controllers to work for the "Oculus Touch Basics". My issue was that I had set my properties wrongly, I had set to joystick instead of touchpad. (my controllers have trackpads doh!)

Does the oculus remote mapping work in a similar way? I assume it would also work for my controllers as well. Is there a good game I can use as a benchmark? I tried a few games listed on the compatability list but some didn't really used the remote and there were others that I couldn't progress in but I wasn't sure if it was because I didn't know how to play the game or it was because my mapping was wrong.

CrossVR commented 7 years ago

This is explained in the wiki, turn off one of your controllers, the remaining one becomes the Oculus Remote. Oculus Farlands is a good test for the remote.

Op 20 apr. 2017 5:08 a.m. schreef "dashingstag" notifications@github.com:

Oh nice I got my controllers to work for the "Oculus Touch Basics". My issue was that I had set my properties wrongly, I had set to joystick instead of touchpad.

Does the oculus remote mapping work in a similar way? I assume it would also work for my controllers as well. Is there a good game I can use as a benchmark? I tried a few games listed on the compatability list but some didn't really used the remote and there were others that I couldn't progress in but I wasn't sure if it was because I didn't know how to play the game or it was because my mapping was wrong.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LibreVR/Revive/issues/576#issuecomment-295562442, or mute the thread https://github.com/notifications/unsubscribe-auth/AB71RoSYeTd-NwySp4fXWcAj9Sgnj_buks5rxsxAgaJpZM4NBQmC .

dashingstag commented 7 years ago

Oh, I thought turning off one controller was optional. Okay thanks for your help!

CrossVR commented 7 years ago

I wish it was, the problem is that games very much expect these to be separate devices. And if the same device sends both Touch and Remote messages that will confuse some games especially those that rely on the Oculus Unity plugin.

I'm still trying to think of good ways to switch between them, but having it depend on the amount of controllers connected still seems like the best option. ALso, Oculus remote games are rare nowadays, so it's not really a problem.

CrossVR commented 7 years ago

By the way, if you don't mind me asking, what kind of custom controller are we talking about?

dashingstag commented 7 years ago

I am playing around with a Ximmerse controller :)

Update: Farlands work with a single ximmerse controller