AndersMalmgren / FreePIE

Programmable Input Emulator
650 stars 144 forks source link

Oculus touch #94

Closed drowhunter closed 1 month ago

drowhunter commented 7 years ago

Added - oculus touch support +added - YawDegrees, PitchDegrees, and RawDegrees to [OculusVr6Dof] struct. +added - exposed some new properties to use in scripting such as isHmdMounted & IsTracking for head, touch controllers

ovr_freepie_read() now returns a [ovr_freepie_data] struct that contains

AndersMalmgren commented 7 years ago

Nice work, please check the casing on your members on the script global, some are camel some are pascal. Python uses camel. Also wouldnt it be nicer to capsulate teh controls into a class so you do

diagnostics.debug(oculusVR.leftTouch.trigger)
drowhunter commented 7 years ago

thanks that's a good idea, I thought about encapsulating them but in freepie the second layer of properties has no intellisense so it would make coding harder..

I can change it to see how it works out..maybe on a different branch in case you don't like it..

drowhunter commented 7 years ago

also you see I've added yawdegrees I was hoping to maybe replace yaw instead..because by default it's in radians but apparently radians are better for calculus..but I find degrees to be more useful since I can sub out oculus tracking for trackir with little effort.

what do you think?

drowhunter commented 7 years ago

I'm not home yet so I haven't touched the code but I've been thinking about it..is it a problem that the oculus controllers are not identical ?

both controls have a trigger, grip, stick

however the left one has x,y & enter

and the right one has a,b & home

so would it be weird having to specify oculusVR.LeftHand.X oculusVR.RightHand.A

?

drowhunter commented 7 years ago

I just updated the branch with the casing fixes you mentioned. Ive been thinking about it and i dont think we should split the controllers into two separate ones because in the sdk left touch and right touch arent really considered two separate controllers they are treated like one controller, similar to the xbox controller

in fact if you look at the button enum it includes all of the xbox buttons and the oculus remote.

ive renamed the head, leftTouch and rightTouch variables to have the Pose suffix to avoid confusion, and ive also renamed the variables to be consistent with the xbox360 Plugin from the oculus sdk..

Describes button input types. Button inputs are combined; that is they will be reported as pressed if they are pressed on either one of the two devices. The ovrButton_Up/Down/Left/Right map to both XBox D-Pad and directional buttons. The ovrButton_Enter and ovrButton_Return map to Start and Back controller buttons, respectively.

typedef enum ovrButton_{
    ovrButton_A         = 0x00000001, /// A button on XBox controllers and right Touch controller. Select button on Oculus Remote.
    ovrButton_B         = 0x00000002, /// B button on XBox controllers and right Touch controller. Back button on Oculus Remote.
    ovrButton_RThumb    = 0x00000004, /// Right thumbstick on XBox controllers and Touch controllers. Not present on Oculus Remote.
    ovrButton_RShoulder = 0x00000008, /// Right shoulder button on XBox controllers. Not present on Touch controllers or Oculus Remote.

    ovrButton_X         = 0x00000100,  /// X button on XBox controllers and left Touch controller. Not present on Oculus Remote.
    ovrButton_Y         = 0x00000200,  /// Y button on XBox controllers and left Touch controller. Not present on Oculus Remote.
    ovrButton_LThumb    = 0x00000400,  /// Left thumbstick on XBox controllers and Touch controllers. Not present on Oculus Remote.
    ovrButton_LShoulder = 0x00000800,  /// Left shoulder button on XBox controllers. Not present on Touch controllers or Oculus Remote.

    ovrButton_Up        = 0x00010000,  /// Up button on XBox controllers and Oculus Remote. Not present on Touch controllers.
    ovrButton_Down      = 0x00020000,  /// Down button on XBox controllers and Oculus Remote. Not present on Touch controllers.
    ovrButton_Left      = 0x00040000,  /// Left button on XBox controllers and Oculus Remote. Not present on Touch controllers.
    ovrButton_Right     = 0x00080000,  /// Right button on XBox controllers and Oculus Remote. Not present on Touch controllers.
    ovrButton_Enter     = 0x00100000,  /// Start on XBox 360 controller. Menu on XBox One controller and Left Touch controller. Should be referred to as the Menu button in user-facing documentation.
    ovrButton_Back      = 0x00200000,  /// Back on Xbox 360 controller. View button on XBox One controller. Not present on Touch controllers or Oculus Remote.
    ovrButton_VolUp     = 0x00400000,  /// Volume button on Oculus Remote. Not present on XBox or Touch controllers.
    ovrButton_VolDown   = 0x00800000,  /// Volume button on Oculus Remote. Not present on XBox or Touch controllers.
    ovrButton_Home      = 0x01000000,  /// Home button on XBox controllers. Oculus button on Touch controllers and Oculus Remote.

    // Bit mask of all buttons that are for private usage by Oculus
    ovrButton_Private   = ovrButton_VolUp | ovrButton_VolDown | ovrButton_Home,

    // Bit mask of all buttons on the right Touch controller
    ovrButton_RMask = ovrButton_A | ovrButton_B | ovrButton_RThumb | ovrButton_RShoulder,

    // Bit mask of all buttons on the left Touch controller
    ovrButton_LMask = ovrButton_X | ovrButton_Y | ovrButton_LThumb | ovrButton_LShoulder |
                      ovrButton_Enter,

    ovrButton_EnumSize  = 0x7fffffff /// \internal Force type int32_t.
}
peroht commented 7 years ago

Any way to emulate the Oculus Touch buttons using freepie?

drowhunter commented 6 years ago

what are the odds of getting this Oculus Touch support merged into main?

I have written a sweet script to allow full locomotion in DOOM VFR

if starting:
    deadzone=0.2
w=oculusVR.leftStickY < -deadzone
s=oculusVR.leftStickY > deadzone
a=oculusVR.leftStickX < -deadzone
d=oculusVR.leftStickX > deadzone
lookleft=oculusVR.rightStickX < -deadzone
lookright=oculusVR.rightStickX > deadzone
turnaround=oculusVR.x or oculusVR.a

keyboard.setKey(Key.W, w)
keyboard.setKey(Key.S, s)
keyboard.setKey(Key.A, a)
keyboard.setKey(Key.D, d)
keyboard.setKey(Key.O, lookleft)
keyboard.setKey(Key.P, lookright)
keyboard.setKey(Key.U, turnaround)

basically follow this guys instructions except instead of using autohotkey

use freepie with the script above instead, works like a charm https://www.reddit.com/r/oculus/comments/7h6nva/smooth_locomotion_in_doomvfr_for_rift_i_scripted/

heres some watchers for testing just add them to the script

diagnostics.watch(w)
diagnostics.watch(s)
diagnostics.watch(a)
diagnostics.watch(d)
diagnostics.watch(lookleft)
diagnostics.watch(lookright)
diagnostics.watch(turnaround)
drowhunter commented 6 years ago

oh and i didn't know what to do about LibOVR not allowed to be included in the freepie source code

so i added a submodule to my repo containing the LibOVR files. not sure if that is acceptable or not.

and im also on visual studio 2017 so the vcxproj is for that

AndersMalmgren commented 6 years ago

@zelmon64 Do you have time to look into this? Also its important our build scripts and installer does not break. When it comes to libovr I have only have the source code checked in and then push the resulting dll to the lib folder

zelmon64 commented 6 years ago

@AndersMalmgren sure thing. I haven't been quite up to coding recently but I'll put it on my to-do list for when I am.

MalikDrako commented 3 years ago

Any news on getting this merged? (and possibly updated - I've been trying out the branch this is from but only the pose is registering for the controllers)