Interacting with Shapes through the Mouse

Hello!

I’m trying to create shapes that you can interact with through the mouse. I want to be able to have a bunch of shapes on the screen and then be able to push them around with the mouse.

Once I can do that I want to add a liquid effect to the shapes so that when the mouse rolls over the shape it’ll cut through. Similar to having a puddle of water on a table and dragging your finger through so it cuts through but then reforms.

Any places that I can look to learn more about interacting with graphics through the mouse and adding physical elements to the graphics would be great.

Thanks!

You could look into Box2D as a starting point: https://github.com/vanderlin/ofxBox2d
That will give you (2D) interaction with the shapes (take a look at some of the examples, they all have varying degrees of mouse-interaction)
Box2D allows you to adjust stuff like gravity and other forces to add physical behaviour to the shapes
As for the ‘liquid effect’ - once you’ve got the above going, you could try splitting a shape in two (new) shapes based on the mouse-position?

good luck!