Coding Challenge #56: Attraction and Repulsion Forces

preview_player
Показать описание


Videos:

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

#forces #vectors #attractionrepulsion #physics #p5js
Рекомендации по теме
Комментарии
Автор

i have attraction with no repulsion to your tutorials. have a good day

fortbrothers
Автор

You know you're doing it right when you get two pictures on the first few rows of google images.

MrCMPUTR
Автор

What a Parker Square of a project.

(the chosen ones will understand)

RedsBoneStuff
Автор

i'll never complain, your videos are stunning.

TheWeepingCorpse
Автор

I think you should code PACMAN as a challenge.

siddharth_singh
Автор

Those images you showed of strange attractors are not produced in any way even close to what you describe. There is no 'attraction' going on beyond the fact that the equations are nonlinear, sensitive to initial conditions, and through repeated iteration of the function on its own outputs they tend to concentrate in particular regions. There is a great book available online which contains tons of code (unfortunately in very antiquated BASIC, though some similarly antiquated C code is available as well) called 'Strange Attractors: Patterns in Chaos' by Julien Sprott. Relatedly, if you ever need new ideas for graphical projects like you do on this channel, check out some of Clifford Pickover's older books like 'Computers and the Imagination' or 'Computers, Patterns, Chaos, and Beauty'. They contain loads of little projects, most with example code.

DustinRodriguez_
Автор

Hey Dan can you recreate centripetal (inwinding) and centrifugal (outwinding) forces as a coding challenge, and spirals and vortexes? Btw thanks for your coding mentorship!

ramseybeing
Автор

Watching this video at 0.5x speed = 100% education + 150% drunken Daniel. Your content is always worth the time.

marcelv
Автор

I'm a bit late with the challenge, but here I am. I tried doing this in C++ with some game library (raylib for those interested) and I tried doing exactly the same approach with the same line order in code but somehow i can't really figure out why my particle is going farther away from the attractor each time it crosses it and not maintaining that max distance from the beginning. It gets to a point where it goes out of my screen.

glaukpataj
Автор

This is my favorite video of yours. Thank you for bringing this awesomeness to my life.

LastRellik
Автор

If you made all particles repel each other, and also repel the walls around the screen, and kept adding new ones every frame, they would eventually reach some strange gaseous equilibrium in the 2D space.

kevnar
Автор

I wasn't really watching the stream when you were doing that, because I was playing games but now I will definitely watch the challenge

kuskus_th
Автор

So many great effect learned from this tutorial.

beaverjoe
Автор

I think this kind of thing would be better with processing honestly. I wanna learn more about processing!

ariseyhun
Автор

Don’t know if you have heard of the “Lenord Jones Potential”. It is used in doing particle attraction/repulsion problems in Molecular Dynamics.

stephenmcconnell
Автор

thats exactly what I was thinking, like perfect electron shells... Do you think you could make a realistic atom simulation with this?

forwardphysx
Автор

15:39 Ill take Ham tickets too!! haha using your tutorials for college study and LOVE Hamilton too!

fergusjanissen
Автор

Would have been interesting if you had made each particle interact with each other instead of the attractors this is an intractable problem if brute forced of complexity O(n!) so only a few particles could have been rendered in real time however would have been cool to see the erratic orbital paths the particles had taken. Regardless great video as usual!

justgame
Автор

This is less coding than flirting. Very successful, Platonic flirting. X

redhen
Автор

Make the particles attractors, you can call them planets!

jimmatheson