icdb

FreePIE: My Summer Car

Apr 25th, 2019
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. #Inspired by TrackIR mouse emulation sample (https://andersmalmgren.github.io/FreePIE/samples.html)
  2.  
  3. def update():
  4.     yaw = trackIR.yaw
  5.     pitch = trackIR.pitch
  6.     x = trackIR.x
  7.     z = trackIR.z
  8.    
  9.     deltaYaw = filters.delta(yaw)
  10.     deltaPitch = filters.delta(pitch)  
  11.      
  12.     if (enabled):
  13.         mouse.deltaX = deltaYaw * lookMultiply
  14.         mouse.deltaY = -deltaPitch * lookMultiply          
  15.     keyboard.setKey(Key.Q, x < -xLeanAmount and enabled)    
  16.     keyboard.setKey(Key.E, x >  xLeanAmount and enabled)    
  17.     #keyboard.setKey(Key.LeftControl, z > -zLeanAmount and enabled) #I have it disabled because I don't like / use it
  18.  
  19. if starting:
  20.     enabled = False
  21.     lookMultiply = 30 #How much does looking around turn your head ingame
  22.     xLeanAmount = 30 #How much leaning is needed to lean ingame
  23.     zLeanAmount = 15 #How much leaning is required to zoom
  24.     trackIR.update += update
  25.  
  26. toggle = keyboard.getPressed(Key.NumberPadStar) #Press this to toggle feature on/off
  27.  
  28. if toggle:
  29.     enabled = not enabled
Add Comment
Please, Sign In to add comment