Get Speed Value of Mouse Movement
Hey Guys,
has anyone an idea how to track the speed of the mouse movement of the user?
Thanks in advance!
Imbie
Speed (velocity) is distance per unit of time...so simply subtract the absolute value of the mouse position at start and end point, then divide by elapsed time. You can do it all with [mousestate] and [timer]. You could even use the delta outputs of [mousestate] to keep a running speed.
Hey Steve, the mouse data goes from 0. to 1. x and 0. 1. y but the user can go constantly anywhere between these to values.
I have a hard understanding how to constantly scan the new speed value for the movement, if you could send a short example patch that would be amazing!
Ok, I think I have figured out the basic function.
I get the speedvalue to a constant time interval.
The only thing left is when moving down the speed goes -.
Is there any good solution for reading all numbers out of the flonum as positiv values?
Edit: think this should work better
Hi
I didn't read the thread but looked at the last patch posted and it looks as if you're trying to get positive values of delta:
Brendan
thanks for your reply brendan!
Just found the abs object some minutes ago, too.
I'm good to go now.
Cheers,
Imbie
velocity can be found by delta, basically [!- ] and [timer] is all you need.
Thank you guys, found this solution working best for me now.
Hi there
I'm, currently drawing with the lcd patcher. I want to speed of the mouse movement to change the colour. Is it cool if I use your mousespeed patch? Will reference by providing a comment on the interface with a link to your posts...