Motion Tracking Mouse COntrol

Jul 15, 2010 at 5:16am

Motion Tracking Mouse COntrol

Hi,

how is it possible to control the XY position of my mouse with motion tracking of an object, say like a crystal ball.

thanks!

#51371
Jul 15, 2010 at 11:14am

I presume you mean cursor (on screen) and not mouse (the physical interface) so this shows how to move the cursor. Turn it on and it will move the cursor position every 30 seconds.

max v2;
#N vpatcher 93 173 310 516;
#P window setfont “Sans Serif” 9.;
#P newex 133 78 48 196617 loadbang;
#P newex 87 140 48 196617 togedge;
#B color 5;
#P message 125 161 14 196617 0;
#P message 87 161 14 196617 1;
#P user pictctrl 87 181 52 41 greenLED.pict 0 0 1 1 3 0 0 0 32 34 128 0 1 1 2 0 1 270;
#P button 158 226 15 0;
#P window setfont “Gill Sans” 10.;
#P window linecount 3;
#P comment 30 39 133 278003722 Move the cursor to a random position every 30 seconds (uses the aka.mouse external;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 87 286 56 196617 aka.mouse;
#P objectname mouse_controller;
#P newex 87 226 70 196617 metro 30000;
#P message 87 268 73 196617 moveto $1 $2;
#N vpatcher 10 59 347 427;
#P window setfont “Sans Serif” 9.;
#P newex 50 214 104 196617 pack;
#P outlet 50 245 15 0;
#P inlet 50 45 15 0;
#P newex 144 189 27 196617 +;
#P newex 50 188 27 196617 +;
#P newex 144 163 77 196617 drunk 480 100;
#P newex 50 163 77 196617 drunk 640 100;
#P newex 177 133 27 196617 !-;
#P newex 83 133 27 196617 !-;
#P newex 83 102 121 196617 unpack 0 0 0 0;
#P newex 83 77 58 196617 screensize;
#P newex 83 50 48 196617 loadbang;
#P connect 9 0 5 0;
#P connect 5 0 7 0;
#P connect 7 0 11 0;
#P connect 11 0 10 0;
#P connect 2 0 7 1;
#P connect 0 0 1 0;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 5 1;
#P connect 2 2 3 1;
#P fasten 9 0 6 0 55 157 149 157;
#P connect 6 0 8 0;
#P connect 8 0 11 1;
#P connect 2 1 8 1;
#P connect 2 1 4 0;
#P connect 4 0 6 1;
#P connect 2 3 4 1;
#P pop;
#P newobj 87 247 72 196617 p random_pos;
#P window setfont “Gill Sans” 10.;
#P window linecount 2;
#P comment 30 78 55 278003722 Use ESC to start/stop;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 87 99 35 196617 sel 27;
#P newex 87 78 40 196617 key;
#P button 87 122 15 0;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P connect 0 0 13 0;
#P connect 13 0 11 0;
#P fasten 12 0 10 0 130 178 92 178;
#P connect 11 0 10 0;
#P connect 10 0 6 0;
#P connect 6 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 7 0;
#P fasten 14 0 12 0 138 159 130 159;
#P connect 13 1 12 0;
#P hidden connect 6 0 9 0;
#P pop;

To track something your going to have to use jit.cv.

Garrett

#184190
Jul 15, 2010 at 12:03pm

is [aka.mouse] an external?

#184191
Jul 15, 2010 at 12:11pm
#184192
Jul 15, 2010 at 8:22pm

unless you need actual clicking, you don’t need aka.mouse. use a message to max:

;max pupdate $1 $2

to move the cursor. this is cross-platform :)

– Pasted Max Patch, click to expand. –
#184193
Jul 17, 2010 at 2:05pm

mmm didn’t know you could do that.

Garrett

#184195
Jul 19, 2010 at 12:28am

yep, between randomly moving the cursor all around and the ability to hide/show it, you could make the world’s most annoying patch.

Also look for “mxj autobot” which is cross-platform, you can find it here

It lets you control the mouse, click, and send keystrokes. Use with care…

#184196

You must be logged in to reply to this topic.