How to Apply Forces to a RigidBody in Godot (2D & 3D)

Поділитися
Вставка

КОМЕНТАРІ • 134

  • @LucyLavend
    @LucyLavend  3 роки тому +73

    Due to wrist pain/RSI I won't be able to work on video's for the next couple of weeks/months. I'm sorry if you were looking forward to more videos soon. Hopefully I'll be able to get back to it once it gets better.

    • @hairiclilred
      @hairiclilred 3 роки тому +10

      Get well soon!

    • @LucyLavend
      @LucyLavend  3 роки тому +6

      Thanks Hairic! ♥️

    • @LosfrogerX
      @LosfrogerX 3 роки тому +3

      I hope you get well soon! I love your videos, love the presentation and find them really helpful and informative!

    • @LucyLavend
      @LucyLavend  3 роки тому +2

      @LosfrogerX Thanks for the kind words! 😄

    • @aabb-eh3mi
      @aabb-eh3mi 3 роки тому

      ❤❤

  • @JustSomeMemes
    @JustSomeMemes 3 роки тому +48

    I recently started slowly building a game in my free time, and I've gotten ideas that this channel coincidentally has a tutorial for each one. I hope this channel blows up!

    • @LucyLavend
      @LucyLavend  3 роки тому +6

      Nice! Good luck on your gamedev journey!

    • @JustSomeMemes
      @JustSomeMemes 3 роки тому +4

      @@LucyLavend Thank you!

  • @WillieTheAutomaton
    @WillieTheAutomaton 8 місяців тому +4

    It's been a while since you posted, but I wanted to say this video helped me immensely. The official documentation was not clicking and this helped me wrap my head around it. Thank you!!

  • @slawomirlach8913
    @slawomirlach8913 3 роки тому +15

    One of the best tutorials for a beginne like me. You just showed with simple examples how powerful the physics in Godot is! Thank You for the hard work!

    • @LucyLavend
      @LucyLavend  3 роки тому

      Thank you! I'm glad you found it useful

  • @jwr26games
    @jwr26games 3 роки тому +7

    The area node explanation is fantastic!! Wish you a speedy recovery so more high quality tutorials will come out!!

  • @RageQuitCasual
    @RageQuitCasual 14 днів тому +1

    I spent my entire morning watching videos to add a swinging mechanic to my game and got nothing useful. After watching this video I had my mechanic in less than one hour. THANK YOU!!!

  • @lv99redchocobo37
    @lv99redchocobo37 2 місяці тому +2

    This is so much what I needed. This helps me understand the differences so well. Thank you!

  • @PioneerWhoDreams
    @PioneerWhoDreams 3 роки тому +8

    Wow, that is amazing tutorial :D
    I absolutely love that you showing an example for every method, please continue !

    • @LucyLavend
      @LucyLavend  3 роки тому +3

      Thank you, glad you liked it 😄

  • @anthonyperkins5370
    @anthonyperkins5370 11 місяців тому +1

    Thank you very much for the help! The part about setting a linear velocity was exactly what I was looking for to help me with my project. 👍

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

    This video has been so helpful to me, thank you so much! Also you have such a lovely voice I could listen to you for hours. Hope your RSI resolved and you are feeling better (I'd hope so after a year x_x) Be well!

  • @Nyltoons1
    @Nyltoons1 3 роки тому +5

    This tutorial is very amazing and really explained a lot about the rigid body. Plus the fact that she genuinely enjoys it really makes it more fun to watch.

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

    Thank you so much for this thoroughful tutorial! I've understood now perfectly how to work with physics in Godot!

  • @RapiereGridoro
    @RapiereGridoro 3 роки тому +3

    the best tutorial that i find on youtube about this

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

    Just discovered your channel, great to have good tutorials for Godot, hope you continue to make more.
    This video helped me get a 3D helicopter/RigidBody3D fully flyable! Thank you!

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

      Great to hear that it was useful to you! 😄

  • @dj2460
    @dj2460 3 роки тому +1

    Your videos are excellent. Clearly explained with great examples. Keep up the good work.

  • @captainbube1217
    @captainbube1217 5 місяців тому +1

    Bru you are an angel/god for these videos, you deserve as much recognition as Clear Code!!!

  • @mikaelkihlstrand
    @mikaelkihlstrand 3 роки тому +2

    Thanks for this, clear and straight to the point!

  • @damonmichiels
    @damonmichiels 3 роки тому +7

    Epic, just what I needed

  • @CelloThe15th
    @CelloThe15th 2 роки тому +1

    Thank you! I was looking for how to move a rolling object using force

  • @YuriLewd
    @YuriLewd 3 роки тому +6

    My physics knowledge isn't super great, but torque is a measurement of a force(Newtons) and a distance(meters), the really high number comes from Newtons being a relatively low amount of force so the final number ends up being pretty high if it's anything with some mass to it.

    • @LucyLavend
      @LucyLavend  3 роки тому +2

      Aah that makes sense, a friend of mine calculated that the ball I had in the video was 700kg... so yea that also seems to contributes quite a bit

    • @miguelinop
      @miguelinop 2 роки тому +1

      It also worth noting that angular velocity requires lower values because it is a direct measurement of speed
      Meanwhile torque is a measurement of force, which includes acceleration (the change of speed over time) and mass

  • @Goldenfightinglink
    @Goldenfightinglink 2 роки тому +2

    Great primer to using 3d rigidbodies. I knew a bit of the rigid2d but was too intimidated to mess with it at the time.

  • @florianvelling6427
    @florianvelling6427 2 роки тому +1

    I watched this video because I was trying to do what point gravity basically does. Man I could have saved time had I watched this video earlier.

  • @Klausterfull
    @Klausterfull 2 роки тому +1

    Very nice the Area2D tip! Didn't know... :) Thanks a lot!

  • @jugibur2117
    @jugibur2117 2 роки тому +1

    Very informative explanation, many thanks!

  • @rindallbroxmitten
    @rindallbroxmitten 6 місяців тому

    Thank you, thank you! I finally found this tutorial which is very clear.
    A question: How would I apply force from the centre of an Area2D towards the centre of the ball? So the Area2D would push the ball away towards the direction the ball came from.
    I'm trying to make a pinball bumper and somehow it's a lot harder than I imagined.

  • @bromigo2252
    @bromigo2252 2 роки тому +1

    nice and in depth, great tutorial!

  • @lukeyd13
    @lukeyd13 2 роки тому

    You are so wholesome, please make more of these if you can

  • @Hana_UwU
    @Hana_UwU 2 роки тому

    love you, the world thanks for this high quality godot guide

  • @IrvanQadri
    @IrvanQadri 3 роки тому +13

    ah yes, Godot Yeet Masterclass

  • @bronxzoo8344
    @bronxzoo8344 2 роки тому +1

    You enplane things very good.

  • @meekymousey
    @meekymousey 2 роки тому +1

    Thanks a lot I was finding a good video for adding force.

  • @DanBeauleArt
    @DanBeauleArt 3 роки тому +1

    This is awesome. Been looking on how to create a function like this in the likes of Dune! Or tiny wing games. I’m super novice at programming so this shall help. I have all the functions working in my game but this one eluded me, Thank you.

    • @LucyLavend
      @LucyLavend  3 роки тому +2

      Thanks, glad it was useful!

  • @j_vzla_libre
    @j_vzla_libre 3 роки тому +1

    Thanks Lucy, nice tutorial.

  • @CuttlasHD
    @CuttlasHD 5 місяців тому +1

    very good video! i learn a lot thank you

  • @zheli2417
    @zheli2417 2 роки тому +1

    Really Good tutorial thank you

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

    annnnd 2 years later this ended my 4 hour issue I was having... thank you lol

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

      Oh wow it's already been two years, didn't realize that. Glad it helped!

  • @just_a_zombie6718
    @just_a_zombie6718 2 роки тому +1

    Because of this video I'll subscribe😊 thank you this is what i need

  • @gustavehrentaler7874
    @gustavehrentaler7874 2 місяці тому

    I think, the reason torque needs such a high value to do anything, is that another length measured in pixels factors in here... (Torque being force applied times distance from the center of reference.) (in case of perpendicular force)

  • @bini420
    @bini420 3 роки тому

    Extremely useful and well explained

  • @Dantonfall
    @Dantonfall 5 місяців тому +1

    Me: sees thumbnail in 2024
    My Brain: “Imaginary Technique… 20 Hour long coding tutorial.”

  • @RenderingUser
    @RenderingUser 2 роки тому +1

    3:20
    i have a problem
    im making an area2d that changes the force on a rigid body that enters it
    and area2d doesn't have integrate forces function
    edit: nvm you covered area2d
    edit2: not quite what i needed from area2d but ok

  • @DrNabeel20
    @DrNabeel20 3 роки тому +2

    This is so greate! Thank you 👏

  • @chri6473
    @chri6473 9 місяців тому +1

    Amazing videos

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

    I wonder if the torque needs to be very big since it's measured in mass*(length/time)^2, and since length in Godot are measured in pixels, squaring it would make it very big compared to force which is just mass*length/(time)^2
    Would you please do a tutorial on position/angle-setpoint pinjoint motor controller? Thanks in advance

  • @psyboyo
    @psyboyo 8 місяців тому +2

    Amazing video! Insta-sub! :D

  • @jovlem
    @jovlem 2 роки тому +1

    Shouldn't these forces be applied in "_integrate_forces"?

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

    amazing video

  • @fallstorm_dev7635
    @fallstorm_dev7635 2 роки тому

    Awesome video! But could you share some code on how I would create a shotgun recoil in 2D? With a rigidbody2D?
    Cheers

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

    Why do the numbers in torque need to be so huge? The answer is that they are measured in Newton x Metres. Newton is quite a tiny unit. Normally, we would express the 80,000Nm as 80kNm
    And thank you so much for all the amazing tutorials ❤

  • @Polarcete
    @Polarcete 12 днів тому +2

    I know this video is 3 years old but, how can i apply force to a rigidbody2d towards where it's facing?

    • @LucyLavend
      @LucyLavend  11 днів тому +1

      Applying a force that is rotated by the local rotation of the Rigidbody2D should work:
      apply_central_impulse(Vector2(1000, 0).rotated(rotation))

    • @LucyLavend
      @LucyLavend  11 днів тому +1

      UA-cam seems to be deleting comments containing code, so I'll try to phrase this a different way:
      you can apply a force on the x axis that rotated by the local rotation of the Rigidbody2D, using the vector2(1000, 0).rotated(rotation)

    • @Polarcete
      @Polarcete 11 днів тому +1

      @@LucyLavend Thank you so much!

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

    has this changed? I'm trying to apply torque to a propeller and either Godot changed how this worked or I'm doing it wrong...

  • @dsfdsdiaz9952
    @dsfdsdiaz9952 2 роки тому

    Hi Lucy, you set the gravity scale of the ball to 8.92 and used the default project gravity: 98. Is there some math reason for this?
    btw: I am trying to make my game less floaty and not sure if I should change the default project gravity or the gravity scale of each object.
    Thank you and hope you are doing great.
    Regards from Buenos Aires :)

  • @princedeka6054
    @princedeka6054 3 роки тому +1

    Excellent video I subbed😃👍

  • @splatling5271
    @splatling5271 3 роки тому +2

    Great video! Just subbed uwu

  • @paypercutts
    @paypercutts 3 роки тому +2

    Thanks Lucyyyyyyy!

  • @yourkodi3945
    @yourkodi3945 2 роки тому

    ia their any guidance on linear velocity vs these?

  • @RyanScottForReal
    @RyanScottForReal 2 роки тому

    I hope you work on one of these for Godot 4 with Character interactions!

  • @s2xy492
    @s2xy492 15 днів тому +1

    great!

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

    Do you know the mathematics behind all these variables?
    I can't find any tutorial on mathematical physics.

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

      Can take a look at Hooke's law

  • @markuspettersen707
    @markuspettersen707 2 роки тому

    lets say im making a 3d car game, should i use impulses or force?

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

    Well. You can use += to modify the velocity.
    I need to test the Torque...
    And figure a way to do Torque and Force at the same time without using the built in methods.

  • @gamedev-isallihave3522
    @gamedev-isallihave3522 3 роки тому +1

    Thank you so much :)

  • @EmilioNorrmann
    @EmilioNorrmann 2 роки тому +1

    so theoretically you can impulse a car by applying torque to the wheels attached to the structure, instead of moving the car itself ! that is accurate !

    • @hodayfa000h
      @hodayfa000h Місяць тому

      How'll the car turn? I doubt it is real life like

  • @Wonkabonka
    @Wonkabonka 3 роки тому +1

    what if i have a rocketship and make it rotate by, apply_ torque_impulse. how do i make it go forward in the direction it is looking at?

    • @LucyLavend
      @LucyLavend  3 роки тому

      If I remember correctly, you can use apply_impule(Vector2(1000, 0).rotated(rotation))
      I'm not at my pc right now so I'm not sure
      I'd recommend having a look at the KidsCanCode video I linked in the description of this video, it also covers how you can make an Asteroids like 2D space ship

    • @Wonkabonka
      @Wonkabonka 3 роки тому +1

      @@LucyLavend thanks, i somehow got it working doing as you said, got a couple errors at first because i didnt know how to properly realise your idea, but i got it now. thank you!!!

  • @elrelster
    @elrelster 2 роки тому

    Late to the game here, but my understanding is that in 3D, the continuous force functions only work in the "_integrate_forces" method of a RigidBody. Not sure why though.

  • @rhevoramirez7969
    @rhevoramirez7969 8 місяців тому +1

    Thanks

  • @rattyredemption
    @rattyredemption 2 роки тому

    hi, i'm relatively new to godot and i'm getting some weird results when using my c sharp code like the following:
    rigidBody.ApplyImpulse (Vector3.Zero, impulseDirection.Normalized () * impulseStrength);
    i had assumed only that rigidbody would be affected but in my tests, other nearby objects also start moving, even if only slightly. if i disable the impulse line then none of the objects move.
    how do we tell impulse to only affect one object?

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

    I don't know why, but my RigidBody2D simply refused to rotate when applying rotation in code (either via apply_impulse() or apply_torque_impulse(). If you have the same problem, add " yield (get_tree(),"idle_frame") " before applying impulse, because skipping a frame fixes it somehow.

  • @princedeka6054
    @princedeka6054 3 роки тому

    Can you make a video on how different collision2d bodies push each ??

  • @vatrenikrug
    @vatrenikrug 2 роки тому +1

    Thank you... Good examples ,hope i now make better game :)

  • @TackerTacker
    @TackerTacker 3 роки тому +1

    2:25 Yea I came across these inconsistencies as well, I'd like to know why that is too. Maybe it is a bug?!

    • @TechnoHackerVid
      @TechnoHackerVid 3 роки тому +1

      My assumption is that it's due to a very high moment of inertia (rotational mass). The RigidBody is already rather heavy (took a 7,000N force to move it) and the moment of inertia is the mass multiplied by the radius of rotation around the object's axis of rotation _squared_

  • @nestoreon3353
    @nestoreon3353 3 роки тому +2

    Gracias 😄

  • @humanbeing8681
    @humanbeing8681 3 роки тому

    Please can you teach how to make a kinematic body fly

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

    I'm making a game that will be just a sandbox where you can launch objects of different shapes with different physics parameters.
    The problem is that absolutely all objects in my case must be Rigidbody2D, otherwise realistic physics modeling will not work (or maybe there is a way ...?)
    The problem is really serious and i without a single clue how to solve it in my case...

  • @HAWXLEADER
    @HAWXLEADER 2 роки тому

    AddCentralForce is really weird...
    I have no idea why it is implemented like this.
    Usually it needs to be applied each frame to stay on.
    It is usually the same is impulse but multiplied by delta

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

    if u don't know i love u sooo much

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

    I think you have omitted the torque in 3D :( otherwise your explanations are very nice to listen and very understandable.

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

    And what about KinematicBody? Is there a way to add impulse to a KinematicBody?

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

      with a kinematic body you have to calculate the forces yourself. You'd have to make your own velocity vector, and apply drag to that. I'd recommend looking at platformer game tutorials for Godot and seeing how they approach it. Specifically how they approach knockback, since that's similar to what you want to do.

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

      ​@@LucyLavendoh damn.... ok, Thanks for the answer.

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

      ​@@LucyLavendok, i kind of found out a workaround for this, with a Variable named fall, which is the variable i use for Jump, fall.y, the problem now is, the Enemy Attack can only make me Jump Upwards, fall.z works but my character can't stop walking backwards once the enemy attacks.

  • @carlonsantosalberto3590
    @carlonsantosalberto3590 3 роки тому

    muy bueno los tutoriales un tutorial de drawing vector in 3d

  • @Flamebamboo
    @Flamebamboo 5 місяців тому

    Hello im having trouble on something can you please help😭

    • @LucyLavend
      @LucyLavend  5 місяців тому

      What are you having trouble with?

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

    how do i add force in the direction the player is facing

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

      Depends on what kind of game you're making and how you rotate the player. If you have a 2D sidescroller and your player is rotated by flipping the sprite, you can multiply the force on the x axis by the x scale of the sprite

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

      3d

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

      @@WOAHVODS I'd recommend looking up some tutorials on 3D projectiles in Godot

  • @rolanddolidze6897
    @rolanddolidze6897 2 роки тому +1

    Too few subscribers for a good chanel as yours

  • @Gureenu
    @Gureenu 3 роки тому

    where go ?

  • @shakirmohammed-
    @shakirmohammed- 3 роки тому +1

    You should also show custom shaders

    • @LucyLavend
      @LucyLavend  3 роки тому

      I'll have a look into that. Would you be more interested in shader code or in using the Shader Graph?

    • @shakirmohammed-
      @shakirmohammed- 3 роки тому

      @@LucyLavend Code

    • @shakirmohammed-
      @shakirmohammed- 3 роки тому

      @@LucyLavend Or you can show both

  • @fabrizioalonzi4122
    @fabrizioalonzi4122 24 дні тому +1

    This voice is very similar to the Michael Jackson's one. 🎶🎙️🎵🎤

  • @atlrvrse
    @atlrvrse 3 роки тому +1

    why is this person cute

  • @seekyunbounded9273
    @seekyunbounded9273 2 роки тому

    YABC

  • @VadimSuharnikov
    @VadimSuharnikov 8 місяців тому

    😂 🎉😢

  • @jaded151
    @jaded151 2 роки тому

    why are you so quite?

  • @blueroman460
    @blueroman460 3 місяці тому +1

    Thanks for the video!

  • @Dandy_kyun
    @Dandy_kyun 2 роки тому +1

    great video