Forums > MaxMSP

collision

May 15, 2010 | 11:11 am

Hi all,

i have three *bidimensional* elements, each of them with x and y coordinates.
I’d like to be able to detect when two of them get closer than a certain distance, and then send a bang.
Right now i’m using a web of [if].
I take every couple of x and y coordinates and process them. like this: [if $1-$2 < mythreshold && $1-$2 >0 then bang], but it seems to be a (very) dumb approach, and never ending…
anybody has an idea?
thanks much!


May 15, 2010 | 11:25 am

I recently got loads of forum help on something similar to this. I needed to detect the collision of the mouse with the edge of an ellipse drawn in lcd. I’m not sure if it will be helpful for you, but the maths needed will be similar, although this depends on what shapes you need to detect for……..it could get very complex!

http://cycling74.com/forums/topic.php?id=26171
(many thanks pizza_olives and jvkr!)

Also, check out the cosm externals from CNMAT. They offer collision detection, but I’m not sure if that includes unusual shapes as well as spherical. I’m not familiar with them ‘yet’, and they seem to be geared towards 3D applications, but they’re worth checking out.

http://www.allosphere.ucsb.edu/cosm/


May 15, 2010 | 12:18 pm

is this what you want?

– Pasted Max Patch, click to expand. –

May 15, 2010 | 12:41 pm

Terry and Tim, thank you very much.
Terry, your patch is as elegant as can be ;-) , AND it what i was looking forward. thanks!


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