Posted February 04, 2017
I modified one of the Start Citizen Freepie scripts to use for XWA. It works pretty well
#Use one:one profile in TrackIR and set Center to Keypad 5
#Tweak Head Track sensitivity using "multiply = X"
#__Change these variables to customize your experience__
if starting:
enabledHT = 0 # Set to True (1) or False (0) depending on if you want the headtracking to begin immediately
multiply = 40 # Speed of head tracking
maxYaw = 18 # How far left and right you can look (this'll help keep you cetered after looking around)
maxPitch = 25 # How far up you can look
minPitch = -15 # How far down you can look (in the cockpits you usually cannot look as far down as you can up)
#__Change this to the exact name in the Game Console Screen__
pedaldev="Joystick - HOTAS Warthog"
#__Change this to the joystick button used to toggle on and off __
button = 4
#__xxx Don't touch from here on down xxx__
if joystick[pedaldev].getPressed(button):
if enabledHT == 0:
enabledHT = 1
keyboard.setPressed(Key.NumberPad5)
keyboard.setPressed(Key.ScrollLock)
speech.say("On")
elif enabledHT == 1:
enabledHT = 0
keyboard.setPressed(Key.NumberPad5)
keyboard.setPressed(Key.ScrollLock)
speech.say("Off")
def update():
global maxYaw
global maxPitch
global minPitch
#__Head Look Section__
if (enabledHT > 0):
if enabledHT == 1: #Look Mode
if -maxYaw <= trackIR.yaw <= maxYaw: #Within the Yaw limits
yaw = trackIR.yaw
elif trackIR.yaw < -maxYaw: #Too far left
yaw = -maxYaw
else: #Too far Right
yaw = maxYaw
if minPitch <= trackIR.pitch <= maxPitch: #Within the Pitch limits
pitch = trackIR.pitch
elif trackIR.pitch < minPitch: #Too far Down
pitch = minPitch
else: #Too far Up
pitch = maxPitch
deltaYaw = filters.delta(yaw)
deltaPitch = filters.delta(pitch)
mouse.deltaX = deltaYaw*multiply
mouse.deltaY = -deltaPitch*multiply
if starting:
speech.say("booting up")
trackIR.update += update
#Use one:one profile in TrackIR and set Center to Keypad 5
#Tweak Head Track sensitivity using "multiply = X"
#__Change these variables to customize your experience__
if starting:
enabledHT = 0 # Set to True (1) or False (0) depending on if you want the headtracking to begin immediately
multiply = 40 # Speed of head tracking
maxYaw = 18 # How far left and right you can look (this'll help keep you cetered after looking around)
maxPitch = 25 # How far up you can look
minPitch = -15 # How far down you can look (in the cockpits you usually cannot look as far down as you can up)
#__Change this to the exact name in the Game Console Screen__
pedaldev="Joystick - HOTAS Warthog"
#__Change this to the joystick button used to toggle on and off __
button = 4
#__xxx Don't touch from here on down xxx__
if joystick[pedaldev].getPressed(button):
if enabledHT == 0:
enabledHT = 1
keyboard.setPressed(Key.NumberPad5)
keyboard.setPressed(Key.ScrollLock)
speech.say("On")
elif enabledHT == 1:
enabledHT = 0
keyboard.setPressed(Key.NumberPad5)
keyboard.setPressed(Key.ScrollLock)
speech.say("Off")
def update():
global maxYaw
global maxPitch
global minPitch
#__Head Look Section__
if (enabledHT > 0):
if enabledHT == 1: #Look Mode
if -maxYaw <= trackIR.yaw <= maxYaw: #Within the Yaw limits
yaw = trackIR.yaw
elif trackIR.yaw < -maxYaw: #Too far left
yaw = -maxYaw
else: #Too far Right
yaw = maxYaw
if minPitch <= trackIR.pitch <= maxPitch: #Within the Pitch limits
pitch = trackIR.pitch
elif trackIR.pitch < minPitch: #Too far Down
pitch = minPitch
else: #Too far Up
pitch = maxPitch
deltaYaw = filters.delta(yaw)
deltaPitch = filters.delta(pitch)
mouse.deltaX = deltaYaw*multiply
mouse.deltaY = -deltaPitch*multiply
if starting:
speech.say("booting up")
trackIR.update += update
Post edited February 04, 2017 by jwilson56