Coding Challenge 177: Soft Body Physics

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 พ.ย. 2024

ความคิดเห็น •

  • @TheCodingTrain
    @TheCodingTrain  ปีที่แล้ว +19

    🚂 Source code and passenger showcase: thecodingtrain.com/challenges/177-soft-body-character
    💫 Support the Coding Train and watch ad-free on Nebula: nebula.tv/videos/codingtrain-coding-challenge-177-soft-body-character

    • @CodeParticles
      @CodeParticles ปีที่แล้ว +1

      @TheCodingTrain, Huge fan sir thank you for this upload! I know you're incredibly busy these days but with all due respect, I feel that you should have done this from scratch like you've done with the quadtree tutorial, 2d physics, the boids tutorial, and countless others instead of using an external library!

    • @tile-maker4962
      @tile-maker4962 ปีที่แล้ว

      This is great. Do you think it is possible to integrate angles instead of springs between points to make it? Like a spring angle or something?

    • @TheCodingTrain
      @TheCodingTrain  ปีที่แล้ว +1

      @@CodeParticles I appreciate the feedback, you might like to see the spring challenge which has some more implementation details! th-cam.com/video/Rr-5HiXquhw/w-d-xo.html

    • @CodeParticles
      @CodeParticles ปีที่แล้ว

      @@TheCodingTrain Thank you! 👍

    • @mathcat4
      @mathcat4 ปีที่แล้ว +1

      Amazing you found time to post another video, your enthusiasm always motivates me to program again!

  • @yohansaba5179
    @yohansaba5179 ปีที่แล้ว +141

    Thank you for everything Daniel, you have such a wonderful soul.

    • @ezrakornfeld8436
      @ezrakornfeld8436 ปีที่แล้ว +8

      He’s like the bob ross of programming

    • @baconheadhair6938
      @baconheadhair6938 25 วันที่ผ่านมา

      Don’t do it dude you have much to live for

  • @xnick_uy
    @xnick_uy ปีที่แล้ว +75

    This is the Coding Challenge video with the highest quality so far: well scripted narrative, lots of tips and logical arguments, an easy to follow and well organized code. Also, the part about how to set up the html and the imports is very appropriate. The video edition also superb.
    This goes to show your experience making these videos, and also dedicating so much time to the book possibly has an impact on your story-telling style, for the better.

    • @TheCodingTrain
      @TheCodingTrain  ปีที่แล้ว +11

      Thank you for this feedback, I really appreciate it!!

    • @ethanmendelson6978
      @ethanmendelson6978 ปีที่แล้ว +2

      @@TheCodingTrain Definitely the best presentation yet. Got halfway through the video without opening my IDE because I was fixed on just watching.

    • @Lurkingbird
      @Lurkingbird ปีที่แล้ว

      @@TheCodingTrain do more apple ii videos it is so good

  • @hotrodhunk7389
    @hotrodhunk7389 ปีที่แล้ว +31

    I just started learning coding. After finding your content it is like a breath of fresh air! You make it seem so fun! The ability to do anything with a computer is really cool and powerful. Thanks for your videos.

  • @AlHearn
    @AlHearn 3 หลายเดือนก่อน

    Daniel, I hope you continue to make your videos. Thank you for the great job you do.

  • @sambeard4428
    @sambeard4428 ปีที่แล้ว +2

    When I watch your videos, I feel you talk to me, not just saying something, but actually talking to me, like I'm a child. But not at all in the negative sense. Your instructions are clear, friendly and unassuming. I hope you either have kids or will some day because I'm sure they'll turn out as marvelously curious little beings.
    Little bit of a weird post, I know, but this is just how I like to express my gratitude.

  • @Sayamak
    @Sayamak ปีที่แล้ว +7

    Daniel really is a great educator and entertainer. Thank you Sir for your videos and especially The Nature of Code where I am currently enjoying the chapter about fractals.

  • @mmilerngruppe
    @mmilerngruppe ปีที่แล้ว +2

    Thank you, Daniel, your videos always make me happy!

  • @wxr
    @wxr ปีที่แล้ว +1

    I receive every video of the Coding Train as it was a Christmas gift and I was 5 years old !
    I'm so happy and excited !

  • @zer001
    @zer001 ปีที่แล้ว +2

    nice to have you back.

  • @niczoom
    @niczoom ปีที่แล้ว +1

    Super clear explanations. I learn something new every video watched!

  • @jetexeryt1127
    @jetexeryt1127 3 หลายเดือนก่อน

    I like how i can watch all coding challenges, even those from 6 years ago and litterally the only thing that changed is his hair color (and this is the best thing that could happen)

  • @Haapavuo
    @Haapavuo ปีที่แล้ว +1

    Greetings from Finland! 🇫🇮 That is where you inspiration came from this time! 😉

  • @richardsymes1844
    @richardsymes1844 ปีที่แล้ว +1

    So good to see you back and with another interesting challenge.

  • @tehcakelie17
    @tehcakelie17 ปีที่แล้ว +1

    This is amazing! this came in clutch when I've been researching simple way to create softbody physics. Thank you for this!

  • @redpug5042
    @redpug5042 ปีที่แล้ว +1

    it sure would be fun to write the physics engine on your own. I just spent about an hour or so making a quick engine with a system for springs and force fields (a force applied to specified particles based on the particle's conditions like location, hence "field")

  • @IzUrBoiKK
    @IzUrBoiKK ปีที่แล้ว +5

    I am mainly a python programmer, but often use your videos as a tutorial for things. Thanks bro for all this. ❤❤❤

  • @RedEyedJedi
    @RedEyedJedi ปีที่แล้ว +4

    OMG you're writing a new version of the nature of code :D I have the original and its my favourite book by a mile.

  • @mrthomaschannelearth
    @mrthomaschannelearth ปีที่แล้ว +1

    Code refactoring is one of the few things that bring me true joy in this life

  • @AaronAsherRandall
    @AaronAsherRandall ปีที่แล้ว +3

    I have always loved your videos! I am a novice game programmer in C# and Unity, it seems like a lot of these tools in Javascript could be expanded to make games with complex physics and graphics in the browser!

  • @KnakuanaRka
    @KnakuanaRka ปีที่แล้ว +1

    I need to catch up on the Coding Challenges.

  • @nagesh007
    @nagesh007 ปีที่แล้ว +1

    Awesome , Mind Blowing 😍

  • @RupertBruce
    @RupertBruce ปีที่แล้ว

    I don't have notifications on and it took YT 2 months to suggest this. I have surely watched enough of your videos to get instant feed updates regardless of the notification settings.

  • @Bromon655
    @Bromon655 ปีที่แล้ว +2

    This is gonna sound crazy but the conversation about repetitive code starting at 15:04 really helped me visualize the purpose of object oriented programming as opposed to procedural programming. Noobish and oddly specific but still

  • @KakoriGames
    @KakoriGames ปีที่แล้ว

    Fun fact, soft body simulations actually have a lot of similarities with finite element analysis. In fact, one could use a soft body to simulate a ideal truss structure. When it comes to 2D, or 3D, structures, the main difference becomes that the rigidity of the system is calculated based on the shapes between springs, called elements, and there's some resistance to rotation in the nodes, so a square shape doesn't fall flat. But the idea of modeling a continuous body as a set of discrete points forming a graph, that exhibit some degree of rigidity between them, is very much akin to elastic finite element analysis.

  • @jayjasespud
    @jayjasespud ปีที่แล้ว +3

    This train sure has come a long way since departure.

  • @pierregof
    @pierregof ปีที่แล้ว

    Thank you Daniel 🙏

  • @s81n
    @s81n 2 หลายเดือนก่อน

    Omg I had no clue you wrote The Nature of Code. I adore that book!

  • @chopstix9093
    @chopstix9093 ปีที่แล้ว +2

    its been too long since a coding train video ;-; thank you!!!

  • @spacelamaglama
    @spacelamaglama 9 หลายเดือนก่อน +1

    what a nice video! You are like the Bob Ross of developing

  • @WilderPoo
    @WilderPoo ปีที่แล้ว +1

    Amazing! Thank you for really demystifying soft body physics. I thought it would be much more complicated than a few springs 😄

  • @parkeranderson7599
    @parkeranderson7599 ปีที่แล้ว +1

    Soft body physics... my doctor has been wanting me to work on this!😉

  • @nimlhug138
    @nimlhug138 ปีที่แล้ว +4

    WOW... I got a flashback of a younger version of me having fun with SodaConstructor back in 2000-2001

    • @sodaplayer
      @sodaplayer ปีที่แล้ว

      Ooh, I loved playing with that. >.> I even still have my username named after it.

  • @kapilishere
    @kapilishere ปีที่แล้ว +4

    It was fun to watch, I'd definitely code my own squishie character!

  • @offtheball87
    @offtheball87 ปีที่แล้ว

    I'd love to see the making of the final character!

  • @zer001
    @zer001 ปีที่แล้ว +1

    Danke! Thank you!

    • @TheCodingTrain
      @TheCodingTrain  ปีที่แล้ว +1

      Thanks for the generous support!

  • @beefox__
    @beefox__ ปีที่แล้ว

    fun fact! the youtuber who explained recently how jelly car worked, he actually made jelly car!

  • @Sasham4
    @Sasham4 4 หลายเดือนก่อน

    Thanks!

  • @anon_y_mousse
    @anon_y_mousse ปีที่แล้ว

    Are you going to do rigid body physics next? Maybe throw a squishy sphere at a brick wall at varying speeds and animate it bouncing off and breaking through.

  • @PeranMe
    @PeranMe ปีที่แล้ว +14

    Oooh, new NoC version! Pardon my drooling here...

    • @cpasket122
      @cpasket122 ปีที่แล้ว +3

      How the hell did you comment 7 hours ago if the video was released 5 hours ago???

    • @PeranMe
      @PeranMe ปีที่แล้ว +3

      @@cpasket122 What? I'm just that fast, ok? Keep up!
      (Subscribers sometimes get videos early)

    • @cpasket122
      @cpasket122 ปีที่แล้ว +1

      @@PeranMe oh, thought you were a time traveler or something lol

  • @wlockuz4467
    @wlockuz4467 ปีที่แล้ว +2

    Can't wait for Nature of Code!

  • @shachargabbay1496
    @shachargabbay1496 ปีที่แล้ว

    wow. you are simply a magician. I've been dreaming about this for years!!!!

  • @Parasbhattarai1
    @Parasbhattarai1 ปีที่แล้ว

    ❤❤love everything done for us and teaching in. Such a cool way❤❤❤

  • @고가-y7o
    @고가-y7o ปีที่แล้ว

    Thank u so much! I can’t express how much your video helped me but I ‘m surely that you have saved the whole of my college life!😂

  • @donnierussellii4659
    @donnierussellii4659 ปีที่แล้ว

    Thanks for helping the programming community own the toxi libs.

  • @stormwix
    @stormwix 8 หลายเดือนก่อน +1

    1:32 The second picture to the left kinda reminds me of a Hyperbolic tessellation 🤔. Anyone else?

  • @Hoobizone
    @Hoobizone ปีที่แล้ว

    Such a great content! Thanks!!

  • @codex57
    @codex57 ปีที่แล้ว

    Génial !!!

  • @partymarty1856
    @partymarty1856 ปีที่แล้ว

    glad to see you making video (I've watched one so far"

  • @NinjarioPicmin
    @NinjarioPicmin ปีที่แล้ว +3

    0:30 that is truly beautiful. Any idea on where to read up on how that was done?

    • @WhateverOwO
      @WhateverOwO ปีที่แล้ว +3

      it's probably pressure soft-body physics with really low pressure and k parameters

  • @PS3centere
    @PS3centere ปีที่แล้ว

    when destructuring you can write {VerletPhysics2D: physics} to rename the destruct.

  • @LoPhatKao
    @LoPhatKao ปีที่แล้ว

    pretty cool that you're doing a rewrite of NoC
    read it last year and played around with Processing
    niftiest sketch I did was an ant pheromone trail behaviour simulation, reminiscent of SimAnt surface view

  • @felipe1876
    @felipe1876 ปีที่แล้ว

    i understand 15% of the eps, but it is so cool even so

  • @Liloulalalala
    @Liloulalalala ปีที่แล้ว

    Yeeeees new coding challenge !!

  • @nathanroed6924
    @nathanroed6924 ปีที่แล้ว +1

    please do a series where you make a rigid body physics system without physics libraries like box 2D

    • @vsueiro
      @vsueiro ปีที่แล้ว +1

      Hi, Nathan! In his Nature of Code playlist, Dan builds the basics of a physics engine from scratch… It’s just amazing!

    • @nathanroed6924
      @nathanroed6924 ปีที่แล้ว +1

      @@vsueiro thanks, I'll be sure to watch it!

  • @pbenikovszky1
    @pbenikovszky1 ปีที่แล้ว

    ah finally a new video :) great as always :).

  • @DOROnoDORO
    @DOROnoDORO ปีที่แล้ว

    RETURN OF THE KING

  • @olasoderlind5685
    @olasoderlind5685 ปีที่แล้ว

    more videos , fun watching. :)

  • @Masda.X
    @Masda.X ปีที่แล้ว

    Thanks a lot sir!

  • @robinkelmen6332
    @robinkelmen6332 ปีที่แล้ว

    Hi, Loved the video! Would you be able to do a video with collision detection between 2 shapes consisting of a set of points and springs?

  • @jf4715
    @jf4715 ปีที่แล้ว +1

    I miss your videos!

  • @Freestila
    @Freestila ปีที่แล้ว

    I never did javascript. I code java for a living, but js and p5 was new to me :) But this looked soo fun, that i wanted to try it. got some problems with preview in vs code (since web editors are not my thing...), but it was really fun :) So thanks for that :)

  • @dreamofeternalhappiness8001
    @dreamofeternalhappiness8001 ปีที่แล้ว +1

    Yay. 👽✌️ Keep making programming fun for everyone and become rich. You are super fun. Knowledge is boring only if there is none to play with it. ❤ * individual physical position vector.

  • @o_2731
    @o_2731 ปีที่แล้ว

    I really regret i didnt find this video when i started coding

  • @cypher2960
    @cypher2960 ปีที่แล้ว

    hi daniel. thank you for everything, you've tought me alot. but could you please try to demessify you playlists please. you have so many greate tutorials and course but they are all out of order and sometimes missing. thankfully someone else has make a playlist of you coding challanges. you've tought a whole lot but honestly i makes my head explode going through it all to find the ones i want. i would learn alot more if your playlists and courses where organized in your channel or a website per say. just a segestion.

  • @kimeg7294
    @kimeg7294 ปีที่แล้ว +3

    Hello Daniel, this was very fun to watch and educational for learning how particles behave based on soft body interactions. Would this principle be applicable for simulating a "verlet cloth" effect on particles forming a 2D rectangular shape?

    • @TheCodingTrain
      @TheCodingTrain  ปีที่แล้ว +1

      Yes! You can see more about this in an older video: th-cam.com/video/jrk_lOg_pVA/w-d-xo.html

  • @pablobribiesca2596
    @pablobribiesca2596 ปีที่แล้ว

    I was like
    "Ohh this reminds of Jelly car... Great game and amazing memories with my brother"
    Popped up out of the blue

  • @namelastname4077
    @namelastname4077 ปีที่แล้ว

    Another Dane saves the day. They invented C++, PHP, C# and V8

  • @emilie1977
    @emilie1977 ปีที่แล้ว +4

    wow good subject! I want simulate my home under earthquake ;)

  • @ToastaToast
    @ToastaToast ปีที่แล้ว +2

    I'd like to learn more about object destructuring

    • @deanolium
      @deanolium ปีที่แล้ว

      It's pretty straight forward.
      Say you have an object `X` with the properties `a`, `b`, and `c`. You can access these by doing:
      X.a
      X.b
      X.c
      You can also assign these to local variables to make it easier to access:
      let a = X.a
      let b = X.b
      let c = X.c
      Object destructuring is a thing which lets you do all this in a single line by doing:
      let {a, b, c} = X
      This then creates local variables which are set to the properties on `X` that have the same name. You can use this to pick and choose which properties you want:
      let {a, c} = X // This only picks X.a and X.c
      You can also rename properties:
      let {a: newA} = X // We now have a variable called newA that is the same as X.a
      Finally you can store the remaining, non-picked properties using the rest operator `...`
      let {a, ...otherProps} = X
      // We now have the variables `a` and `otherProps` where `otherProps` is an object with properties otherProps.b and otherProps.c
      It's all basically shorthand but very, very useful.

  • @mthia
    @mthia ปีที่แล้ว

    another coding challenge nice!!!

  • @Michi0-0
    @Michi0-0 ปีที่แล้ว

    You are the nicest guy ever❤❤❤

  • @Zzkkb98
    @Zzkkb98 ปีที่แล้ว

    The only place wheyi feel that i can code what i want

  • @drobotk
    @drobotk ปีที่แล้ว

    Would it be possible to make 2 buddies collide and bounce together using this library?

  • @mileshunter3280
    @mileshunter3280 ปีที่แล้ว

    Great video. What's the name of the tune at 3m30s?I can't get it out of my head.

  • @joshblitz194
    @joshblitz194 ปีที่แล้ว

    Is there a circuit emulator playlist on this channel?

  • @lucbloom
    @lucbloom ปีที่แล้ว

    The JellyCar update is triggering a revisit of softbody physics projects by a bunch of devs :-)

  • @bwremjoe
    @bwremjoe ปีที่แล้ว

    What about detecting and resolving colisions between two soft body objectS? Sounds like a can of worms ^^'

  • @tomoki-v6o
    @tomoki-v6o ปีที่แล้ว

    new to the channel , thank for presenting this beautiful topic
    don't you notice the 3D illusion effect 23:55

  • @codingcompetitiveprogrammi6118
    @codingcompetitiveprogrammi6118 ปีที่แล้ว

    can you make video about algorithm and structure
    sir you should become professor and teaching in highest university like MIT and harvard

  • @alexandermcclure6185
    @alexandermcclure6185 7 หลายเดือนก่อน

    but how do i make the springs themselves without toxiclibs :(

  • @andrewcrook6444
    @andrewcrook6444 ปีที่แล้ว

    Don’t they have dampeners with springs?

  • @euglossine_tristanwhitehill
    @euglossine_tristanwhitehill ปีที่แล้ว

    ❤❤❤❤❤

  • @darkfrei2
    @darkfrei2 ปีที่แล้ว

    Is it code for slime and truss physics?

  • @x_czt
    @x_czt ปีที่แล้ว

    The ToxicLib is the next Golan Levin

  • @itsjase92
    @itsjase92 ปีที่แล้ว

    Is there a reason you prefer the p5js web editor over something like openprocessing? I only recently discovered it but it seems much nicer

  • @gorillasun
    @gorillasun ปีที่แล้ว +1

    Juhani, look! You're on TV!

  • @zer001
    @zer001 ปีที่แล้ว

    07:24 is this like the using system.windows.forms in C#?

  • @russellg3775
    @russellg3775 ปีที่แล้ว

    Wait, new edition of The Nature of Code coming?

  • @sharadkumarsingh4802
    @sharadkumarsingh4802 ปีที่แล้ว

    Write a "complete" physics engine (from scratch) [in 60 mins]

  • @matthewhook3375
    @matthewhook3375 ปีที่แล้ว

    Novice here, please could someone explain why referencing a global variable from within a class is considered bad practice (as discussed at 20:38)?

  • @SleepyGaryBASS
    @SleepyGaryBASS ปีที่แล้ว

    👍👍

  • @alwysrite
    @alwysrite ปีที่แล้ว

    jesus ! you have risen from the dead ! happy easter : )

  • @aliciadelpino8209
    @aliciadelpino8209 ปีที่แล้ว

    I'm doing it on vs code and it says that 'GravityBehavior' is undefined and that it cant access "physics" before initialization :(

    • @TheCodingTrain
      @TheCodingTrain  ปีที่แล้ว +2

      Can you pop into the coding train discord we can help there! Link in description.

    • @aliciadelpino8209
      @aliciadelpino8209 ปีที่แล้ว

      @@TheCodingTrain Thank you for replying so fast! that's amazing, I will do that, thank you!

  • @01binaryboy
    @01binaryboy ปีที่แล้ว

    Buy the Book(Nature of Code 2nd edition) option not working

    • @TheCodingTrain
      @TheCodingTrain  ปีที่แล้ว

      It's not out yet, the site is just a preview! (old version: natureofcode.com/)

  • @unveil7762
    @unveil7762 ปีที่แล้ว

    🎉❤🎉

  • @gknomics
    @gknomics ปีที่แล้ว

    hey daniel i tried copying the code but on my end it isnt working can you pls explain?

    • @gknomics
      @gknomics ปีที่แล้ว

      btw really great video

  • @zewela
    @zewela ปีที่แล้ว

    Does anyone done that in Visual Studio Code? I have problem with toxiclibsjs 🥺

  • @howardalien2720
    @howardalien2720 ปีที่แล้ว

    How would one make this without a physics engine? Like from a raw programming language?

    • @garrethutchington1663
      @garrethutchington1663 ปีที่แล้ว

      Learn the basic principles of physics and code it yourself 😊

    • @gower1973
      @gower1973 ปีที่แล้ว

      You don’t need a physics library to do what he did here, it’s pretty simple stuff, have a look at his spring and pendulum videos, I took what he did there and implemented it c++ with direct 2d as the canvas

    • @deanolium
      @deanolium ปีที่แล้ว

      The paper he linked to has the basic formulae needed to create this. Basically it's about figuring out what the next position of a point is based on the previous position and acceleration vector applied to it. Then you add in the constraints, but rather than it be fixed, you use the constraints to change the acceleration vector applied to the point based on how far from the 'ideal' length the point is. Add gravity and you get your own physics engine.

    • @howardalien2720
      @howardalien2720 ปีที่แล้ว

      thanks guys

  • @goatman86
    @goatman86 ปีที่แล้ว

    But does it jiggle?