Skip to content

Instantly share code, notes, and snippets.

@lethak
Created September 23, 2025 19:01
Show Gist options
  • Select an option

  • Save lethak/8b70d3644822b28f537ebffba42fb803 to your computer and use it in GitHub Desktop.

Select an option

Save lethak/8b70d3644822b28f537ebffba42fb803 to your computer and use it in GitHub Desktop.
FreePie script : TrackIR to Mouse (pitch+yaw)
#Use one:one profile in TrackIR
#Tweak Head Track sensitivity using "multiply = X" "Insert" key to toggle on/off
#__Change these variables to customize your experience__
if starting:
enabledHT = False # Set to True or False depending on if you want the headtracking to begin immediately
multiply = 14 # Speed of head tracking
#__Change these button to remap the toggle keys__
toggleHT = keyboard.getPressed(Key.Insert) #Toggle Head Tracking
#=========================================================#
def update():
yaw = trackIR.yaw
pitch = trackIR.pitch
zoom = -trackIR.z
lean = trackIR.x
deltaYaw = filters.delta(yaw)
deltaPitch = filters.delta(pitch)
deltaLean = filters.delta(lean)
#__Head Look Section__
if (enabledHT):
mouse.deltaX = deltaYaw*multiply
mouse.deltaY = -deltaPitch*multiply
#__xxx Don't touch xxx__
if starting:
trackIR.update += update
if toggleHT:
enabledHT = not enabledHT
if(enabledHT):
speech.say("tracking to mouse")
else:
speech.say("off")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment