Half-Life 2 Rifted with YEI 3-Space Wireless


A quick weekend experiment using Half-Life2, Oculus Rift, a YEI 3-Space Sensor, and FreePie

The skipped parts are me fighting to find the use and jump button on ladders and getting out of the water X.x

If I try this again I might rebind the gamepad to be more one handed friendly. Also need to make the trigger a bit more reactive, it took too much pressure to pull at times it kept messing up shots.

  1. # FreePie Script for YEI 3-Space Sensor
  2. def update():
  3. diagnostics.watch(yei[0].yaw)
  4. diagnostics.watch(yei[0].pitch)
  5. diagnostics.watch(yei[0].roll)
  6. # Axis directions used (X: Left, Y: Back, Z: Up)
  7. # Negative X, Y
  8. x = yei[0].yaw
  9. y = yei[0].roll
  10.  
  11. delta_x = filters.delta(filters.continousRotation(x))
  12. delta_y = filters.delta(filters.continousRotation(y))
  13.  
  14. if tracker_mouse:
  15. mouse.deltaX = delta_x * multiply
  16. mouse.deltaY = delta_y * multiply
  17. mouse.leftButton = yei[0].button0
  18.  
  19. if starting:
  20. multiply = 1000
  21. tracker_mouse = False
  22. yei[0].update += update
  23.  
  24. tare_sensor = keyboard.getPressed(Key.T)
  25.  
  26. toggle = keyboard.getPressed(Key.O)
  27.  
  28. if toggle:
  29. tracker_mouse = not tracker_mouse
  30.  
  31. if tare_sensor:
  32. yei[0].tareSensor()