Vjoy Axes Controlled by Keyboard
Posted: Thu Nov 05, 2020 7:49 am
Hi,
I am looking to control the Z axis of a Vjoy joystick so that if I press Num 0, the axes moves down and if I press Num Enter it moves up, but incrementally.
I also dont want it to auto center.
I can make a script to make this happen, but not on an incremental basis, just either full min/max.
I need it to act that when I hold down they key, it keeps gradually increasing the value on the axes....
My script so far is:
from System import Int16
# Devices and axis initializing
max = Int16.MaxValue*0.5+0.5 # 16384
min = -Int16.MaxValue*0.5-0.5 # -16384
joystick[0].setRange(min, max)
joyZ = 0
##### Axis fallback, for easy assignment
# Joystick Axis
if keyboard.getKeyDown(Key.NumberPad0):
vJoy[0].z = min
if keyboard.getKeyDown(Key.NumberPadEnter):
vJoy[0].z = max
# vJoy
diagnostics.watch(vJoy[0].z)
I am looking to control the Z axis of a Vjoy joystick so that if I press Num 0, the axes moves down and if I press Num Enter it moves up, but incrementally.
I also dont want it to auto center.
I can make a script to make this happen, but not on an incremental basis, just either full min/max.
I need it to act that when I hold down they key, it keeps gradually increasing the value on the axes....
My script so far is:
from System import Int16
# Devices and axis initializing
max = Int16.MaxValue*0.5+0.5 # 16384
min = -Int16.MaxValue*0.5-0.5 # -16384
joystick[0].setRange(min, max)
joyZ = 0
##### Axis fallback, for easy assignment
# Joystick Axis
if keyboard.getKeyDown(Key.NumberPad0):
vJoy[0].z = min
if keyboard.getKeyDown(Key.NumberPadEnter):
vJoy[0].z = max
# vJoy
diagnostics.watch(vJoy[0].z)