Hi Everyone!

I'm relatively new to pd so apologies if i'm overlooking something obvious
Also, my brain is melted trying to figure this out so hope I make some sense trying to describe it lol

I'm trying to use a usb mouse to track a vertical distance larger than the computer screen and so can't use MouseState or Gemmouse. I'm not sure how to translate this 'rel y' value into a meaningful position. If anyone can help or know's how to do this that would be fantastic ;)

I understand that the mouse data is relative and gives the amount it has moved since the previous value. When the mouse isn't moving the value isn't zero and the last input keeps banging but I found the "how to process relative data from usb-mouse ?" thread which solves this, so now I only get 'rel y' values when the mouse is moving - great :-D but when it moves where is it….?

I tried subtracting the current relative position from the previous one to get the amount of 'steps' moved so that I could then add these together for an overall position. This appeared to work at first, e.g.moved from 1-to-34-to-71-77-95. But since the 'rel y' value are much higher when the mouse moves faster, differences between values doesn't' work consistently and the overall position from cumulative steps go crazy or drops e.g. 77-95-98-65. I put this down to the incoming data stream but maybe there's a more sophisticated maths way of doing this? There probably is but can't figure out how to do the maths or implement in pd

Since the 'rel y' values are incredibly variable, I thought I'd simply convert each number to a bang and count them. But of course the same problem; moving the mouse faster causes more bangs and a higher count. I thought if i took the physics approach of "how many, how fast, for how long", I could determine position. Physics is not a strength of mine but I got some equations online and put into pd but it still seams to be all relative to the speed of the mouse. I tried different polling rates, counter maximums and using triggers etc.

The only other thing I can think of is to use the speed of the mouse to read through a table containing position values

Thanks for any comments/suggestions :)

http://www.pdpatchrepo.info/hurleur/MouseHID-POSITION.pd