Class 02 | Build a Physics Engine | Forces
What I planned to achieve this week is to add 2 functions in terms of FORCES are:
1. Press + hold a mouse, all the mover particles would come rushing to the attractor.
2. Once release the mouse, all the mover particles dispersed outwards.
I tried to experiment with when all the movers particles are all close/attracted to the attractor would dispersed outward really fast and vice versa.
I got really confused with the parameters of the object thats within a function. For example, from the example code below.
Example Code Chapter 2.6: Attraction. >>> Link to Code <<<
I mean it just randomly appeared. There is no declaration of “m” anyway. I understand that its a callback function and what it’s really doing is hold a value and pass it…..right?
At first I tried adding a mousePressed() function to get me started on the no.1 feature I want to get "Press + hold a mouse, all the mover particles would come rushing to the attractor. ".