Guest User

Freepie mouse tracking

a guest
Aug 22nd, 2014
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. def update():  
  2.     #Apply deadband filter to avoid drift
  3.     #And continousRotation filter to yaw axis to avoid jumps when passing tracker center
  4.     x = filters.deadband(filters.delta(math.degrees(filters.continousRotation(android[0].googleYaw))), deadband)
  5.     y = filters.deadband(filters.delta(math.degrees(android[0].googleRoll)), deadband)
  6.    
  7.     mouse.deltaX = x * x_multiply
  8.     mouse.deltaY = -y * y_multiply
  9.    
  10. if starting:
  11.     deadband = 0.1
  12.     x_multiply = 15
  13.     y_multiply = 15
  14.     android[0].update += update
Add Comment
Please, Sign In to add comment