I've written iPhone - Mac, Client - Server app that allows to use mouse via touchpad.
Now on every packet sent I move cursor by pecific amount of pixels (now 10px). It isn't accurate. When i change sensitivity to 1px it's to slow.
I am wondering how to enhance usability and simulate mouse acceleration.
Any ideas?
I suggest the following procedure:
ON THE IPHONE:
xandydirection, let's name thisdxanddy.dr = sqrt(dx^2+dy^2).v = dr/dt.v_new = a * v + b * v^2(start witha=1andb=0for no acceleration, and then experiment for optimal values)dr_new = v_new * dt.x/ydirection:dx_new = dx * dr_new / dranddy_new = dy * dr_new / dr.dx_newanddy_newto the Mac.ON THE MAC:
dx_newanddy_newpixels inx/ydirection.NOTE: This might jitter a lot, you can try averaging the velocity after step (3) with the previous two or three measured velocities if it jitters to much.