Collision Detection: Bouncing balls within a circular container

I will try to be brief. Any help, links, tips, suggestions would be greatly appreciated!

  • I am trying to build a software version of the OP-1 Tombola sequencer.
  • Basically, every time a ball comes in contact with the container it will send a midi note.
  • Currently midi-note-sending is working.
  • I'm having issues where the balls are escaping the circle. I found some forum posts on this but didn't come away quite with - what I was hoping for. Any re-linking to other posts would still be appreciated.
  • I will eventually want to make this with a hexagon, like the op1, or maybe even be able to open up the shape so balls can fall out. If this is my eventual goal, should I scrap working with a circular container... or will the changes I asked for help with be of use no matter what shape I work in?
  • I tried working with the fisica library, but originally gave up after trying to create custom compound shapes. I did find an awesome e-book on collision detection... perhaps I need to try implementing my code now with fisica again..

Thanks folks!


Here's a gif of the sketch:

The code doesn't seem to want to display properly, so here's a gist:



Sign In or Register to comment.