How can I attract lines and points to mouse position

hello guys, I’m doing a Kaleido sample, and I would like to know if it’s possible attract the lines and point that I draw to mouse position after press a specific key

First step , draw

second step, press key ‘a’ to create the Kaleido

third step: press key ‘b’ to attract the lines and points to the current position of the mouse…

I still do not know how to do it, can anyone give me some advice? because I don’t know if I can do it using particles

thanks :slight_smile:

look at examples/math/particlesExample in your OF folder

Check section 2.9 here, might be useful -

In short, generate an attraction force from the mouse point for all of the particles and update them.

1 Like