collision

May 15, 2010 at 11:11am

collision

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!

#50374
May 15, 2010 at 11:25am

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/

#180754
May 15, 2010 at 12:18pm

is this what you want?

– Pasted Max Patch, click to expand. –
#180755
May 15, 2010 at 12:41pm

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

#180756

You must be logged in to reply to this topic.