Created
December 3, 2016 07:43
-
-
Save WhiteMagic/8aefeb409c93a362ac2118b3ecb67acf to your computer and use it in GitHub Desktop.
Joystick Gremlin pedal merging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gremlin | |
from vjoy.vjoy import AxisName | |
pedal = gremlin.input_devices.JoystickDecorator( | |
"INSERT PEDAL NAME", | |
(3491117066, 0), | |
"Default" | |
) | |
left_pedal_val = 0 | |
right_pedal_val = 0 | |
def pedal_position(): | |
return gremlin.input_devices.deadzone( | |
(right_pedal_val - left_pedal_val) / 2.0, | |
-0.95, | |
-0.05, | |
0.05, | |
0.95 | |
) | |
@pedal.axis(1) | |
def left_pedal(event, vjoy): | |
global left_pedal_val | |
left_pedal_val = event.value | |
vjoy[1].axis(AxisName.Z).value = pedal_position() | |
@pedal.axis(2) | |
def right_pedal(event, vjoy): | |
global right_pedal_val | |
right_pedal_val = event.value | |
vjoy[1].axis(AxisName.Z).value = pedal_position() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment