Skip to content

Instantly share code, notes, and snippets.

@simlrh
Created October 7, 2016 19:41
Show Gist options
  • Save simlrh/6c9ee2e1bdc6316d82943a29aadb86ba to your computer and use it in GitHub Desktop.
Save simlrh/6c9ee2e1bdc6316d82943a29aadb86ba to your computer and use it in GitHub Desktop.
FreePIE hydra script
global leftHand
global left1
global left2
global left3
global left4
global leftBumper
global leftJoystickButton
global leftMiddle
global leftJoystickX
global leftJoystickY
global leftTrigger
global rightHand
global right1
global right2
global right3
global right4
global rightBumber
global rightJoystickButton
global rightMiddle
global rightJoystickX
global rightJoystickY
global rightTrigger
if starting:
leftHand = OSVR.tracker("/me/hands/left")
left1 = OSVR.button("/controller/left/1")
left2 = OSVR.button("/controller/left/2")
left3 = OSVR.button("/controller/left/3")
left4 = OSVR.button("/controller/left/4")
leftBumper = OSVR.button("/controller/left/bumper")
leftJoystickButton = OSVR.button("/controller/left/joystick/button")
leftMiddle = OSVR.button("/controller/left/middle")
leftJoystickX = OSVR.analog("/controller/left/joystick/x")
leftJoystickY = OSVR.analog("/controller/left/joystick/y")
leftTrigger = OSVR.analog("/controller/left/trigger")
rightHand = OSVR.tracker("/me/hands/right")
right1 = OSVR.button("/controller/right/1")
right2 = OSVR.button("/controller/right/2")
right3 = OSVR.button("/controller/right/3")
right4 = OSVR.button("/controller/right/4")
rightBumper = OSVR.button("/controller/right/bumper")
rightJoystickButton = OSVR.button("/controller/right/joystick/button")
rightMiddle = OSVR.button("/controller/right/middle")
rightJoystickX = OSVR.analog("/controller/right/joystick/x")
rightJoystickY = OSVR.analog("/controller/right/joystick/y")
rightTrigger = OSVR.analog("/controller/right/trigger")
hydra[0].enabled = True
hydra[0].isDocked = False
hydra[0].side = 'L'
hydra[1].enabled = True
hydra[1].isDocked = False
hydra[1].side = 'R'
def update():
global leftHand
global left1
global left2
global left3
global left4
global leftBumper
global leftJoystickButton
global leftMiddle
global leftJoystickX
global leftJoystickY
global leftTrigger
global rightHand
global right1
global right2
global right3
global right4
global rightBumber
global rightJoystickButton
global rightMiddle
global rightJoystickX
global rightJoystickY
global rightTrigger
hydra[0].x = leftHand.position.x
hydra[0].y = leftHand.position.y
hydra[0].z = leftHand.position.z
hydra[0].yaw = leftHand.yaw
hydra[0].pitch = leftHand.pitch
hydra[0].roll = leftHand.roll
hydra[0].start = left1.value
hydra[0].one = left1.value
hydra[0].two = left2.value
hydra[0].three = left3.value
hydra[0].four = left4.value
hydra[0].bumper = leftBumper.value
hydra[0].joybutton = leftJoystickButton.value
hydra[0].start = leftMiddle.value
hydra[0].joyx = leftJoystickX.value
hydra[0].joyy = leftJoystickY.value
hydra[0].trigger = leftTrigger.value
hydra[1].x = rightHand.position.x
hydra[1].y = rightHand.position.y
hydra[1].z = rightHand.position.z
hydra[1].yaw = leftHand.yaw
hydra[1].pitch = leftHand.pitch
hydra[1].roll = leftHand.roll
hydra[1].start = right1.value
hydra[1].one = right1.value
hydra[1].two = right2.value
hydra[1].three = right3.value
hydra[1].four = right4.value
hydra[1].bumper = rightBumper.value
hydra[1].joybutton = rightJoystickButton.value
hydra[1].start = rightMiddle.value
hydra[1].joyx = rightJoystickX.value
hydra[1].joyy = rightJoystickY.value
hydra[1].trigger = rightTrigger.value
diagnostics.watch(leftHand.position.x)
diagnostics.watch(leftHand.position.y)
diagnostics.watch(leftHand.position.z)
diagnostics.watch(leftHand.roll)
diagnostics.watch(leftHand.pitch)
diagnostics.watch(leftHand.yaw)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment