Forums > MaxMSP

node object with nodes in other shapes than circles

January 8, 2012 | 3:20 pm

Hello,

i use a 3 axis accelerometer as a 3d pointing device. i am building a user interface where you can define areas which are triggering events if you hit them with the virtual pointer of the device.

it should be possible to draw rectangular shapes with the mouse that work as triggers.

Is it possible to give the node-circles of the node object another shape (rectangle) or is there another ui element that could be used for that?

lcd with sprites and selfmade collision detection will do the trick, but perhaps there is something re-usable…

thanks,

Joa


January 10, 2012 | 2:26 pm

Very interesting i would like to know too!


January 10, 2012 | 7:42 pm

you can use the jit.phys objects to handle collision detection from any screen coordinates, using the "screenraytest" message to jit.phys.world.

the jit.phys.bodies can be any one of several simple shapes, combinations of simple shapes, or arbitrary shapes defined by sending a matrix of vertices to the jit.phys.body object.

the patch below shows a basic implementation using the mouse (however any input device can be used, as long as it’s mapped to screen coordinates).

please let me know if you have any questions.

– Pasted Max Patch, click to expand. –

January 11, 2012 | 12:50 am

I can’t wait to dig into the physics stuff! Looking forward to trying these example patches…

…but if you’re Max 6-challenged as of now…

you can do a workaround using different colors and [suckah], using any shapes you want, but you’ll see the colors. Or you can use the mouse output of jit.pwindow or jit.window, and have the mouse cursor auto-move with

;max pupdate $1 $2

You can also use [hover] and choose some rectangular objects to work with. Or maybe a gigantic [tab] with multiple rows and columns, and check the hover outlet.

even further, because you know the movements of your pointing device, you can just test for "bounds" directly with a bunch of [expr] objects for position.


Viewing 4 posts - 1 through 4 (of 4 total)