Coding Challenge #56: Attraction and Repulsion Forces
In this challenge, I create a particle system and add "attractors" simulating attraction and repulsion forces. Code: https://thecodingtrain.com/challenges/56-attraction-and-repulsion-forces
πΉοΈ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/6WL2O4vq0
π₯ Previous video: https://youtu.be/f5QBExMNB1I?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ Next video: https://youtu.be/ZiYdOwOrGyc?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
Videos:
π Vectors Video: https://youtu.be/vqE8DMfOajk
π Gravitational Attraction: https://thecodingtrain.com/tracks/the-nature-of-code-2/noc/2-forces/5-gravitational-attraction
π΄ Live Stream #76: https://youtu.be/OkkjlHTdLGI?t=4692
Timestamps:
00:00 Introduction to the Challenge!
02:31 Explanation of Gravitational Attraction
05:04 Create a particle and an attractor
07:26 Add physics to the particles
11:09 Explanation of force and Newton's Second Law
13:04 Create the attraction force vector
17:51 Fine tuning the attraction force
19:34 Drawing the trails of the particle
20:37 Adding multiple particles and other changes
23:08 Adding multiple attractors
27:13 More visual changes and emerging patterns
32:31 Creating attractors with the mouse
35:11 Add repulsion force
35:55 Create alternating attractors and repellers
37:59 Suggestions for improvement and tuning parameters
38:30 Adding repulsions when particle is close to the attractor
43:42 Wrapping up and more possibilities
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
π Website: http://thecodingtrain.com/
πΎ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
π© Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
π‘ GitHub: https://github.com/CodingTrain
π¬ Discord: https://thecodingtrain.com/discord
π Membership: http://youtube.com/thecodingtrain/join
π Store: https://standard.tv/codingtrain
ποΈ Twitter: https://twitter.com/thecodingtrain
πΈ Instagram: https://www.instagram.com/the.coding.train/
π₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA
π p5.js: https://p5js.org
π p5.js Web Editor: https://editor.p5js.org/
π Processing: https://processing.org
π Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct
This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new
#forces #vectors #attractionrepulsion #physics #p5js