icdb icon

FreePIE: My Summer Car

icdb | PRO | 04/25/19 10:39:45 AM UTC | 0 ⭐ | 446 👁️ | Never ⏰ | []
Python |

1.03 KB

|

None

|

0 👍

/

0 👎

#Inspired by TrackIR mouse emulation sample (https://andersmalmgren.github.io/FreePIE/samples.html) 
 
def update():
    yaw = trackIR.yaw
    pitch = trackIR.pitch
    x = trackIR.x
    z = trackIR.z
   
    deltaYaw = filters.delta(yaw)
    deltaPitch = filters.delta(pitch)  
     
    if (enabled):
        mouse.deltaX = deltaYaw * lookMultiply
        mouse.deltaY = -deltaPitch * lookMultiply           
    keyboard.setKey(Key.Q, x < -xLeanAmount and enabled)    
    keyboard.setKey(Key.E, x >  xLeanAmount and enabled)    
    #keyboard.setKey(Key.LeftControl, z > -zLeanAmount and enabled) #I have it disabled because I don't like / use it
 
if starting:
    enabled = False
    lookMultiply = 30 #How much does looking around turn your head ingame
    xLeanAmount = 30 #How much leaning is needed to lean ingame
    zLeanAmount = 15 #How much leaning is required to zoom
    trackIR.update += update
 
toggle = keyboard.getPressed(Key.NumberPadStar) #Press this to toggle feature on/off
 
if toggle:
    enabled = not enabled

Comments