Simulating Gravity with Bolt Visual Scripting

Поделиться
HTML-код
  • Опубликовано: 24 дек 2024

Комментарии • 38

  • @shyamarama
    @shyamarama 4 года назад +2

    7:25 V. Interesting. This tutorial and your entire channel are pretty great! Thanks for everything!

  • @deviate910
    @deviate910 4 года назад +2

    Thank you so much!!!! I also commented on Brackey's tutorial "Unity Gravity" using C#, which was very helpful. But this video was the tutorial I have been looking for~~~!!! Because I was hopelessly ineffective at C#, I wanted to script it out using Bolt. It has been a fun journey, however I really appreciated this video to increase my understanding of Bolt. Previously starting out with Bolt with this very project in mind, And seeing if I could solve this without any help, I was able to get the orbits functioning semi-accurately! (I lost days!) Originally, I attempted to simulate gravity and orbits WITHOUT using Rigidbodies, plugging in the actual mass of the sun and earth, and calculating F=MA, and using the gravitational constant, and so forth, but ended up getting in heaps of issues. Apparently, and I could be mistaken, but Bolt doesn't handle very large numbers ... unable to handle exponents 10e+30 or larger? The mass of the sun in kg for example. Bolt offers the variable type of Float, but not Double? So I ran some conversions (into metric tonnes), abstracted the values further, and was able to approximate an orbiting velocity, which was pretty cool! But I scripted together the Bolt blocks in a painfully different way than what you show here. I did so without using lists, methods, or iterating through loops. I used Lots of scene variables and lots of generic math blocks. I cast lots of Floats to Vector 3s, and used the "Transform > Translate" and "Transform > Look at (other objects)" to run the orbital motion. But WHY was it that my planet was spiraling outward, and slowly losing velocity ?? It just confounded me!!! Maybe it was because I hadn't considered "Fixed Update?" Not sure. ANYHOW your tutorial just shows how elegantly this is performed, and much more simply. I have so much appreciation and Genuine gratitude to you for teaching me how to do this! WOW, so Awesome!!!! I'll definitely check out your other videos too. Peace.

  • @minecraftermad
    @minecraftermad 4 года назад +1

    9:00 nested for loops would be better because for some objects you're doing the same math twice.
    for(x from 0-->planetcount){
    for(y from x-->planetcount){
    calculategravitybetween(x,y)
    }
    }

  • @yasmine1157
    @yasmine1157 4 года назад

    if i wanted to make different planets go around, different speeds etc. Do I have to re-do everything for those objects? i want them to each spin differently, and I have 8 objects, so I rather not build this whole thing everytime. Is there a simpler way to do it?

    • @OneWheelStudio
      @OneWheelStudio  4 года назад

      Gravity should take care of the speed. It's all "physics" based. So the distance to the "sun" or point of orbit partially determines the speed of orbit at least when talking about a circular orbit. If you want to make the objects rotate faster or slower (as a whole) you'll have to change the mass of the object they rotate around.

    • @yasmine1157
      @yasmine1157 4 года назад

      ​@@OneWheelStudio Thank you for replying! Yes, that makes sense but if I want different gravity bodies at different speeds. How do I do that? because right now all my gravity bodies rotate together at the same speed but I want them to be different.

    • @OneWheelStudio
      @OneWheelStudio  4 года назад

      @@yasmine1157 You can look up orbital speed and see the variables that effect it (link below), but if you want more control you may want to go away from a physics based model. www.physicsclassroom.com/class/circles/Lesson-4/Mathematics-of-Satellite-Motion#:~:text=The%20orbital%20speed%20can%20be,speed%20of%207780%20m%2Fs.

    • @yasmine1157
      @yasmine1157 4 года назад

      @@OneWheelStudio yes but this is the only tutorial I can find that shows how to make a solar system using bolt in unity. If there is a less complicated non-physics tutorial that you could point me to, I would really really appreciate it. Because I have not been able to find anything that isn't c# and am much more comfortable and experienced with bolt.

    • @OneWheelStudio
      @OneWheelStudio  4 года назад

      I’m not aware of any. This all really depends on what you are trying to do. If you just want the appearance of orbits but don’t care about physics you could create an empty parent for each planet out the parent at the sun, move the planet out the distance you want it and then rotate the parent.

  • @minecraftermad
    @minecraftermad 4 года назад

    15:00 the accelerates at the same rate that's what G is

    • @OneWheelStudio
      @OneWheelStudio  4 года назад

      The acceleration of the planet is certainly proportional to G but it is also proportional to the mass of the sun a_planet = G*M_sun/r^2

    • @minecraftermad
      @minecraftermad 4 года назад

      Ah ok i had misunderstood www.physicsclassroom.com/class/circles/Lesson-3/The-Value-of-g#:~:text=Its%20value%20is%209.8%20m,of%20g%20about%20earth's%20surface.

    • @OneWheelStudio
      @OneWheelStudio  4 года назад

      @@minecraftermad Yeah, the little g is used for acceleration. It's not the best naming and choice of symbols :)

  • @benjaminstorch4388
    @benjaminstorch4388 5 лет назад

    Thank you for a great tutorial ! I tried to add another child sun to the source game object, but the planet is not reacting to that one -
    do I need to change anything in the flow machine to include more list items ?

    • @OneWheelStudio
      @OneWheelStudio  5 лет назад +1

      Did you add a "gravity source" flow macro to the child? If not try that. If you did let me know and we can try to debug some more.

    • @benjaminstorch4388
      @benjaminstorch4388 5 лет назад

      Thanks for your quick reply ! At the moment the flow macro is only attached to the parent gravity source and works for the one child 'sun' - so I thought if I copied it as a second child it would behave the same, since the source would automatically include all the child objects ? Or do I have to do something to the gravity source list ?

    • @OneWheelStudio
      @OneWheelStudio  5 лет назад +1

      The child is m just a visualization. Each flow graph is actually the source of gravity. So just duplicate the sun flow macro and all. Whatever has the gravity source flow macro will act as a source.

    • @benjaminstorch4388
      @benjaminstorch4388 5 лет назад

      Oh, so I have to create a separate source for each attractor ? And they will all be referenced together by the macro ? That makes sense, thank you ! Will keep you posted if I create anything attractive ...

  • @michaeljonesmedia
    @michaeljonesmedia 3 года назад

    I finished the graphs for the Gravity Manager and my planet flys AWAY from the sun instead of towards it... time to check the math again.

    • @OneWheelStudio
      @OneWheelStudio  3 года назад

      Yep. Sounds like a sign error ;)

    • @michaeljonesmedia
      @michaeljonesmedia 3 года назад +1

      @@OneWheelStudio I fixed it! Not sure where the problem was, I just started from the top and it's working now :)
      I have since tied the main camera to follow one of the gravity bodies that will act as the player, and set up inputs to apply forces along each axis. I am trying to make a game where you have to slingshot around a few gravity sources to get to a goal trigger as fast as possible. Now that I have the math for gravity between two bodies, I am trying to figure out how I can use that information to draw a line showing the course a gravity body will take at it's current speed and trajectory, and that will update in real time with the players inputs applying small forces for course correction.
      Thanks for this tutorial - it has inspired me to learn a lot more about both Unity and orbital mechanics!

    • @OneWheelStudio
      @OneWheelStudio  3 года назад

      That sounds like a challenge! Very cool. Would love to see it when you get it going. Might be worth checking out this video on trajectory prediction. ruclips.net/video/4VUmhuhkELk/видео.html

  • @tonybuckner6524
    @tonybuckner6524 5 лет назад

    Amazing bro

  • @brianstanky
    @brianstanky 2 года назад

    Faux gravity?

  • @yasmine1157
    @yasmine1157 4 года назад +2

    I am doing this tutorial now in 2020, and some things have changed since he filmed this. If you follow each step with a newer unity, it wont work. When you add the graph variables add them as AotList not List rigidbody, it wont work if you do that.

  • @FreexYouTube
    @FreexYouTube 4 года назад

    Устарело. В Bolt (unity 2019.3.0f3) отсутствует List

    • @OneWheelStudio
      @OneWheelStudio  4 года назад

      Sorry, not sure what that error is about. Make sure you have the latest version of Bolt. You may need to jump on the Bolt discord - those guys can probably help. I'm using Unity 2019.3.2f1 and Bolt 1.4.11 and am able to create a list of rigidbodies.

  • @smollismollisworld5655
    @smollismollisworld5655 5 лет назад

    Wow, do you speak fast :o thought on slowing down a little? Besides that a great tutorial, thanks.

    • @OneWheelStudio
      @OneWheelStudio  5 лет назад

      I do talk fast. I've gotten better believe it or not. Some folks like the speed others find it challenging... Glad you liked the video even if rarely stop to breathe :)

    • @smollismollisworld5655
      @smollismollisworld5655 5 лет назад +1

      Breathing is totally overestimated :) but yes, I can use a 0.75x factor to slow down, there is a great ZBrush instructor who is also a super fast talker. Must slow him down, too :)

    • @jojobee228
      @jojobee228 5 лет назад

      @@smollismollisworld5655 I am guessing he is Michael Pavlovich? :P

    • @smollismollisworld5655
      @smollismollisworld5655 5 лет назад

      @@jojobee228 :D right on!

    • @deviate910
      @deviate910 4 года назад +1

      @@OneWheelStudio Don't worry, we can pause/restart the video just fine!

  • @Menjut
    @Menjut 5 лет назад +1

    Man, u should buy ad for r channel. U r great youtuber, but u have too small views.

    • @OneWheelStudio
      @OneWheelStudio  5 лет назад

      Go spread the word! It’s tough to get traction even with ads. Thanks for the encouragement.