Intermediate Python Tutorial | Gravitational Slingshot Simulation

Поділитися
Вставка
  • Опубліковано 3 лис 2024

КОМЕНТАРІ • 59

  • @TechWithTim
    @TechWithTim  Рік тому +8

    Sign up for my FREE Software Development Introduction course here: techwithtim.net/dev - this it the best resource to actually land a job and network with a group of like minded developers 💪

  • @tuekhang11
    @tuekhang11 Рік тому +7

    I really like the way you integrate coding with physics. This is very interesting! Hope you will create more tutorial videos about physics simulation in coding. I also really love the cell simulation you made several weeks ago!

  • @gregf9160
    @gregf9160 Рік тому +8

    MASTERCLASS!

  • @plinketharry7469
    @plinketharry7469 Рік тому +2

    Dude this was perfect, Im loving the mix of physics in with coding lessons. Would be cool to see a build with multiple planets. Also these hourish long tutorials are the perfect length and skill level for me right now so thats super helpful.

  • @winzerprince222
    @winzerprince222 6 місяців тому +1

    If you make the planet size like 350 you can make the spacecraft enter the planet's orbit depending on how you launch it

  • @timbeard8457
    @timbeard8457 9 місяців тому

    Super video. Have saved the link to be able to use it as a reference. Just what I've been looking for. I wanted to practice some object-oriented coding in Python based on physics simulations (I love the maths stuff!) I wasn't sure which graphics library to use, so this was an excellent intro to pygame. Looks pretty straightforward.
    One thought about the acceleration calculation: couldn't you simply calculate the distances, force and acceleration separately in the x and y directions? They you could avoid all the Pythagoras and trig calculations. I'm pretty sure I'm correct here, but haven't checked the maths yet.

  • @juliacoggins7292
    @juliacoggins7292 Рік тому +1

    Hey Tim, very cool project. As a theoretical physics graduate, I really appreciate it!

  • @Jackson141vja
    @Jackson141vja 11 місяців тому

    I have been watching your tutorials for while now and I really like this type of videos! keep it up!

  • @fudgenuggets405
    @fudgenuggets405 Рік тому

    These are my favorite videos. I would like to see more physics simulators. Maybe something that draws out lines of magnetism to get away from classical mechanics and delve into electrodynamics.

  • @MyriadColorsCM
    @MyriadColorsCM Рік тому

    That was a great tutorial, and easier than I thought it would be.
    Im working on a fork of the project, im trying to implement a path prediction for the object before the player clicks.

  • @schielkemusic
    @schielkemusic Рік тому

    Very well made tutorial, im just starting out in python knowing only the basics and learned very much here, thank you!

  • @gregorybuser
    @gregorybuser Рік тому

    I LOVE the video, it’s probably one of the very best I’ve ever seen and I’ve watched thousands.
    My physics is no better than my Python, but it seems to me like all the messing around with trigonometry was unnecessary: given the distance A with x, y components being the x and y distances, wouldnt the force vector A have x and y components in equal proportion to x and y distance? No solving for theta required?

  • @samukaze5810
    @samukaze5810 21 день тому

    Best tutorial out there

  • @darrenselvage6972
    @darrenselvage6972 10 місяців тому

    This is a nice programming exercise; but this is not the classical "slingshot maneuver" that was used by spacecraft like the Voyager probes to increase their speed. If the field were larger, the object would either reach escape velocity but be moving slower than when it started or would fail to escape the gravity well, would ultimately crash back into the planet or (if you were very lucky with your vector) establish a stable orbit. The slingshot maneuver, or gravity assist, used to accelerate a spacecraft only works if you simulate the motion of the planetary body. I would call this more of a gravity well simulation. If you want more information, check out the Wikipedia Gravity Assist page. Still a cool exercise.

  • @esrx7a
    @esrx7a Рік тому

    Nice physics, thank you Tim
    Hey, thanks for bringing up the sponsor of this video, that which I wanted to know about

  • @garrettsmith315
    @garrettsmith315 Рік тому

    looks like you've been hitting the gym too ! Great stuff can't wait to try out the course!
    Been revisiting a lot of your Flask material lately, I find myself needing an update.....

  • @JorgeEscobarMX
    @JorgeEscobarMX Рік тому

    My favorite video so far🎉

  • @JorgeEscobarMX
    @JorgeEscobarMX Рік тому +1

    Listening to this while I'm playing elite dangerous and I can say that the sling shot effect is a thing while you travel at 100c near a planet.

  • @OG22812
    @OG22812 Рік тому

    Bruv u don’t need to watch the whole video, only the idea of the this project is amazing

  • @paulthomas1052
    @paulthomas1052 Рік тому

    Great simulation - thanks !

  • @rverm1000
    @rverm1000 Рік тому

    can you add a change in color to the object based on speed.. great video, that is the stage i need to advance to next.

  • @johnnytoobad7785
    @johnnytoobad7785 Рік тому

    This is a great simulation project to see how objects work in "real time".
    However I think there is some confusion in the last section.
    Your are adding components of an acceleration vector to obtain a velocity vector and then sum the components of a velocity vector
    to obtain a position vector. Every time you perform an "ADD" operation in "move" you essentially drop a physical dimension d/s2 -> d/s -> d.
    So your essentially summing apples, oranges and pears.
    I see it working... but those "vector" additions would fail a physics exam since all the vectors discussed have a different set of units.
    Each "time slice" of the simulation changes only the relative x&y positions of the ship.

    • @fudgenuggets405
      @fudgenuggets405 Рік тому

      It works for this simulation if you think of each frame refresh as simulating one second (assuming acceleration and velocity are in "per sec^2 and per sec units). If each refresh is assumed to represent one second then you are multiplying acceleration by one second to get velocity and multiplying velocity by one second to get position. Obviously you don't have to type out * 1 sec in the equations.

    • @timbeard8457
      @timbeard8457 9 місяців тому

      I'm definitely a big fan of pedantry and you are correct, but I think for this coding demo, it is sufficient. One could have calculated real sizes, masses, distances and speeds, but that would have been unnecessarily complicated and a tad boring without adding an acceleration factor.

  • @fabiokido
    @fabiokido Рік тому +2

    The video reminded me of Angry Birds Star Wars!

  • @X-razcal-X
    @X-razcal-X Рік тому

    Nice. Thanks Tim 🎉

  • @zackzellto4403
    @zackzellto4403 Рік тому +3

    Tim, I have always wondered and it always makes me feel so far behind lol, but do people just know what to build right off their mind or what type or research is done for this type of project? Do you follow a tutorial or course to build? Do you have to look up much in order to build it?

    • @jesuschris9543
      @jesuschris9543 Рік тому +2

      If you know the math, and know how to read documentation, and have a solid under of object oriented programming, iit’s pretty easy

    • @TheLukasBer
      @TheLukasBer Рік тому +1

      He's probably reading the code in another screen while he codes along. To make the first code it probably took him some time too. It's not that simple to just think about this project and code all of that while explaining with no mistakes.

  • @kengounited
    @kengounited Рік тому

    Get the initial velocity vector point toward earth's center and you're gonna get a blowup in finite time :-)

  • @faizi2895
    @faizi2895 Рік тому

    Please cover these django topics
    how to enter multiple entries in database, signals,
    How to use pagination, data table, jwt token and rest ful apis

  • @ag88301
    @ag88301 Рік тому +1

    he should make a tutorial on reimplementing the collision system to take into account the roche limit of the planet and eventually make it into a whole spacecraft game lol

  • @48_subhambanerjee22
    @48_subhambanerjee22 Рік тому

    Amazinggg ☠️☠️💀💀. You sre python god

  • @oleng5398
    @oleng5398 Рік тому

    Thats cool

  • @popel_
    @popel_ Рік тому

    How do you like the idea of creating a course on Django 4.2?

  • @shaniceervin1465
    @shaniceervin1465 10 місяців тому

    Does it matter which one I pick between course careers and programming expert? I can go to college but the only problem is I just found out that Covid and I really don’t get along well haha so I have to avoid the virus if possible. Hopefully find a remote Job but if I have to go into an office I’ll just wear a good mask and pray.

  • @BeginnersCoding92
    @BeginnersCoding92 Рік тому

    Amazing Explanation :)

  • @ananthraj9386
    @ananthraj9386 Рік тому

    Epic 👏👏

  • @dupadupa8371
    @dupadupa8371 Рік тому +3

    Tim, what vsc theme are u using? :>

  • @nassosdimou3337
    @nassosdimou3337 Рік тому

    Hey mojo is out, will you make a tutorial in what it can do?

  • @carzetonao
    @carzetonao Рік тому

    Smart

  • @moritzdeiaco2798
    @moritzdeiaco2798 Рік тому

    Nice one

  • @TheBenchPressBoss
    @TheBenchPressBoss Рік тому

    Hey tim, When i try to import sys on pycharm why wont it allow me to add it to the python interpreter?

  • @joaovisto
    @joaovisto Рік тому

    I just watched the solar system video yesterday

  • @alperklc7782
    @alperklc7782 23 дні тому

    thanks tanks thanks :=)

  • @anzarrabbani3766
    @anzarrabbani3766 10 місяців тому

    35:07 im getting sort of a glitch when i make a bunch of objects i get a huge red line on my screen anyone know why

  • @mohbcn
    @mohbcn Рік тому

    could you please make a video on Tic-Tac-Toe AI 🙏🙏

  • @jabirmustafasulaiman5147
    @jabirmustafasulaiman5147 Рік тому

    How many years take to become intermedia programmer

  • @Participant616
    @Participant616 Рік тому

    Get some sunlight Tim.

  • @ChristopherBruns-o7o
    @ChristopherBruns-o7o 9 місяців тому

    Lol better at coding then spelling... Bahaha i have the same problem when surfing the web and reading!!!

  • @george_papal4930
    @george_papal4930 Рік тому +1

    where is the project on github? Can anyone sent a ling

    • @TechWithTim
      @TechWithTim  Рік тому

      github.com/techwithtim/Slingshot-Effect-Simulation

  • @vmartme
    @vmartme 9 місяців тому

    Really weird I made the same game last summer in my free time :D But my is little beter (have more option) :P lol

  • @palashjyotiborah9888
    @palashjyotiborah9888 Рік тому +2

    Sponsored by Myself. 😅😅😅😂🎉

  • @TawanaChingarande
    @TawanaChingarande Рік тому

    how does bro not know how to spell gravitational

  • @nobdysus8326
    @nobdysus8326 Рік тому +1

    first