Page 1 of 1

Android script mouse emulation

Posted: Sun Oct 21, 2018 8:48 am
by Tonymaz
Hello guys!! :) Any script to use the gyro of my android??? i tried the basic script from the website and It moves but not with the correct axes... :(

Thanks a lot!! :lol:

Re: Android script mouse emulation

Posted: Sun Oct 21, 2018 8:54 am
by Tonymaz
I want just for Stream games from Moonlight(nvidia) plus aim with the gyro of the phone. Ty!

Re: Android script mouse emulation

Posted: Sun Oct 21, 2018 10:43 am
by Tonymaz
I tried a lot of scripts and no one works coz always give errors on the log except the official one from freepie website
-Android mouse emulation with deadband and continous yaw-

But its not working properly dont know why, Maybe its a problem for curves... Help me please :$

Re: Android script mouse emulation

Posted: Sun Oct 21, 2018 12:41 pm
by Tonymaz
I found this one working perfecto except for some jitter:

def update():
global yaw
global roll
global pitch
yaw = -android[0].googleYaw
roll = -android[0].googleRoll
pitch = android[0].googlePitch

if starting:
yaw = 0
roll = 0
pitch = 0
enabled = False
android[0].update += update

diagnostics.watch(yaw)
diagnostics.watch(roll)
diagnostics.watch(pitch)

deltaYaw = filters.delta(yaw)
deltaPitch = filters.delta(pitch)
deltaRoll = filters.delta(roll)

if math.fabs(deltaYaw) >= math.pi:
deltaYaw = 0

if (enabled):
mouse.deltaX = -deltaYaw400
mouse.deltaY = -deltaRoll800

toggle = keyboard.getPressed(Key.M)

if toggle:
enabled = not enabled

And this one have bad the axis but with much less jitter:

def update():
#Apply deadband filter to avoid drift
#And continousRotation filter to yaw axis to avoid jumps when passing tracker center
x = filters.deadband(filters.delta(math.degrees(filters.continousRotation(android[0].pitch))), deadband)
y = filters.deadband(filters.delta(math.degrees(filters.continousRotation(android[0].yaw))), deadband)

mouse.deltaX = x * multiply
mouse.deltaY = y * multiply
if starting:
deadband = 0.01
multiply = 5
android[0].update += update

Can i just mix bouth?? Thanks ppl! :)

Re: Android script mouse emulation

Posted: Sun Oct 21, 2018 1:12 pm
by Tonymaz
I found that the last scripts works perfect but only with the phone flat informaciĆ³n the table, if i use informe landscape It losses their axes... And its not straight its like doing a curve.. Ty guys!