## Get Speed Value of Mouse Movement

Nov 26, 2012 at 7:11am

# Get Speed Value of Mouse Movement

Hey Guys,

has anyone an idea how to track the speed of the mouse movement of the user?

Imbie

#65366
Nov 26, 2012 at 7:17am

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.

#235570
Nov 26, 2012 at 5:10pm

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!

#235571
Nov 26, 2012 at 5:23pm

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?

– Pasted Max Patch, click to expand. –

Edit: think this should work better

– Pasted Max Patch, click to expand. –
#235572
Nov 26, 2012 at 6:31pm

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:

– Pasted Max Patch, click to expand. –

Brendan

#235573
Nov 26, 2012 at 7:12pm

Just found the abs object some minutes ago, too.

I’m good to go now.
Cheers,
Imbie

#235574
Nov 26, 2012 at 10:23pm

velocity can be found by delta, basically [!- ] and [timer] is all you need.

#235575
Nov 27, 2012 at 8:02am

Thank you guys, found this solution working best for me now.

– Pasted Max Patch, click to expand. –
#235576
Mar 4, 2013 at 1:43pm

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…

#235577

You must be logged in to reply to this topic.