The Ultimate Guide for Physics in Game Development!

Поділитися
Вставка
  • Опубліковано 1 січ 2025

КОМЕНТАРІ • 339

  • @WillHessGameDev
    @WillHessGameDev  Рік тому +205

    CORRECTIONS:
    - gravity on earth’s surface, g, is 9.8 m/s^2 and not -9.8m/s^2. The negative comes from saying that it is “pulling you down” and not “pushing you up”
    - a normal force is not just the force that counters gravity. In a Goldilocks scenario where the object is on a flat surface, it is, but normals are perpendicular to the surface, not just straight up in the air.
    If you find more leave a comment and I’ll add it here!

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

      It depends on your choice of coodinate system axes. Choose your x coordinate to increase downwards and the equation for a falling object is going to become s=s0+v0t+½gt² with a positive g (a=g). Choose the opposite direction and you will need a negative value.

    • @1234macro
      @1234macro Рік тому

      @@HoSza1 X coordinate?

    • @WillHessGameDev
      @WillHessGameDev  Рік тому +4

      @@HoSza1I just like to think about it like this, things get thrown in parabolas that open downwards. In order for a parabola to open downwards the term that has t^2 has to be negative so I just throw a negative in there. I usually don’t get too fussed about those negatives because using common sense works fine (until it doesn’t lol).
      Also don’t for get the (1/2) with your at^2 term, or else the integral gods will be sad.

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

      You definitely want to do v squared for fluid forces. But honestly if you have an idea of the motion you want to replicate you are probably best off to keep the full equation and just place in imaginary values for certain prams. The cross section area is easily estimated, and so with that you are left with two parameters; density and drag coefficient. Put the density to the fluid you want it to behave like and put the drag coefficient such as to match whatever you want like terminal velocity or something. That way when you put other elements into your environment they all behave consistently.

    • @oisyn-
      @oisyn- Рік тому +4

      It's not the leaning tower of pizza. It's the leaning tower of Pisa. "Pee-sa" 😉

  • @mehmeh8883
    @mehmeh8883 Рік тому +322

    "thanks to Galileo and his balls.." lmao

  • @maxfrobin8930
    @maxfrobin8930 Рік тому +233

    My man just condensed an entire highschool physics semester into a 1h video... good work! I wish this was the pacing we had at school xD

  • @Nightwulf1269
    @Nightwulf1269 Рік тому +60

    What the actual F***...this is the most explanatory and comprehensive video explaining such complex topics I have ever seen. Extremely good job!

  • @kizlso
    @kizlso 11 місяців тому +22

    I gave up on physics in highschool since our teacher wasn't qualified to even teach. This video is honestly so helpful.

    • @WillHessGameDev
      @WillHessGameDev  11 місяців тому +3

      Glad it was helpful!

    • @sloppyy
      @sloppyy 4 місяці тому +1

      lmao same, it was ostensibly "ap physics c" but we got a guy who only had chemistry training and ended up showing us grateful dead live videos instead. i got a 2 on the ap exam

  • @ItsStaffDaddy
    @ItsStaffDaddy Рік тому +37

    I dropped physics 1 in college and went to a different science for my CS degree because I knew the topics conceptually, but my mathematical understanding of them were lacking (also was working full time and taking classes full time, so that didn’t help). This video alone taught me how to understand them on a deeper mathematical level much better than my professor ever did. Thanks boss

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

      Thank you so much! I’m glad I could help!

    • @alansmithee419
      @alansmithee419 10 місяців тому +3

      Either Physics 1 was way more complicated than this, you weren't paying attention, or your professor *sucked* at teaching.

  • @nenadjovanovski1461
    @nenadjovanovski1461 Рік тому +10

    Great video! Just wanted to mention a small funny moment. You said at 20:55 that static friction should always be greater or equal to dynamic friction, but a few seconds later when you show the unity settings, you entered dynamic 0.25 and static 0.2 friction.
    Apart from that, keep up the good work!

    • @WillHessGameDev
      @WillHessGameDev  Рік тому +5

      Yeah, I was probably just picking random numbers for that… thanks for catching that and watching!

  • @DrZwieback
    @DrZwieback Рік тому +43

    Thanks for pouring so much energy into this video. Must have taken a while to produce. For me this is a super helpful refresher on physics in general and you did a great job relating it to game dev and Unity here. Thanks and subscribed! :)

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

      Thank you so much for watching and subscribing!!!

  • @nikjeewon4672
    @nikjeewon4672 Рік тому +9

    Started looking into math and physics yesterday to buff my gamedev - will be checking this out, thanks for your effort boss!

  • @marmikemp3767
    @marmikemp3767 Рік тому +23

    Finally a truly informational video. Instant sub.

  • @iamyou6555
    @iamyou6555 4 дні тому

    One of the best videos I’ve seen pure concepts and how to apply I’m very proud of you :)

  • @dannydoo3834
    @dannydoo3834 Рік тому +10

    Can't thank you enough for this, you gained my sub brother. I was collecting resources online so I can understand how to implement things. I stumbled upon your video (haven't finished it yet, but the sections you've covered with demos are tremendously useful.) and now everything seems a lot more in place.

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

    I’m going to be honest. When I heard your voice, i thought this was going to be another uniformed, amateur game dev video by some teenager. But I was completely wrong, you absolutely killed it! Great info, succinctly explained. Great job!

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

    best, clearest explanation of this topic I have found yet

  • @oldmankatan7383
    @oldmankatan7383 Рік тому +5

    Rock solid and practical, thank you for putting this out there for everyone!

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

    BROOOO, idk why but that was SEEXYYYYYYY
    No CAP but you explained some concepts in such a way where most professional teachers also fails, SEGGZYYYY

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

    This was invaluable to me as I am learning game development. I greatly appreciate this lecture/tutorial! World Class!!!!!

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

    Hey man, I just saw your video and it was one of the best about physics for game dev, pretty sure that you have spent huge amount of efforts into it. The knowledge was comprehensive and actually being all the knowledge a university student will learn in the first 2 years, which later apply for the game dev. And just want to say you did a great job, really appreciate your work !

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

    Your video is really helpful, I was stuck with creating friction for my game for the last few days then found out your video then I skipped to the 'friction' part and your explanation help me in just 5 seconds to figure it out.

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

    Liked, subscribed, shared, and commented...
    If there were anything else that I could do, I would bro, this is considered a piece of art, the art of making concepts easy to understand, without cutting any part of it.
    Awesome work man, appreciate the time and energy you put into this video ❤

  • @daka.notatp
    @daka.notatp Рік тому +6

    19 minutes in and my brain is fried. i'll come back tomorrow

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

      Physics is a tricky subject and can get confusing fast. Here is some (not very good) words of encouragement my physics teacher would say, “all physics is, is F=ma, and everything else comes from that”

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

    Now this is S tier content! Tnx so much! May your channel blow up!

  • @LRTOTAL
    @LRTOTAL Рік тому +59

    Pro vectors tip:
    If you had problems calculating the angle of a vector from 0 to 360° (or 2π rad), it's probably because you used atan(y/x) instead of the 2-argument arctangent: atan2(y, x) which takes the two variables.
    Dividing y/x before passing it to the arctan function actually loses information about directionality, for example -1/1 = 1/(-1). But (1, -1) and (-1, 1) are not the same vector and don't represent the same angle.

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

    Really useful video. I don't know how accurate it is but I learned a lot :D Thanks for doing this and I hope you'll get more views :)

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

    Such a gem, hope you cover more physic topic in the future

  • @skylark.kraken
    @skylark.kraken Рік тому +1

    I don’t know if it’s mentioned in the video as I haven’t finished it, but my favourite way to do physics only requires saving a velocity vector and simply multiplying that by a float that is in the order of `pow(0.99, MSPT)` every frame after velocities have been updated, as it will cap the velocity to a certain amount with a given acceleration. It also makes everything smooth and it’s really easy to change friction by changing the 0.99 into 0.999 for ice or 0.95 for more friction.
    You can also change the friction based on direction of travel. For my game that I’m working on all accelerations work the same, it doesn’t matter if you’re on ice you know that if you start moving now and move 5 blocks right you’ll be at the same velocity as normal, having ice be slower acceleration is possible but I don't feel there's enough of a benefit.
    The difference is when it comes to deceleration, changes happen when you either release controls or when changing direction (changing direction has higher drag allowing for quicker changes)
    The movement feels amazing and fluid. Multiplying by a float less than 1 simulates air resistance without doing anything complicated and actually dealing with forces

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

      That’s pretty big brain. To me it seems like a classic game dev solution of doing stuff that makes it feel like real life without being 100% accurate, and there is nothing wrong with that at all. This video was more designed as a physics primer and explain a bunch of physics concepts that would be useful to know when making games and how you can use them. So no, I did not cover any of that in the video, but good on you for finding a cheeky work around for all this silly real life math I’m doing lol!

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

      This sounds like a Verlet integration?

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

    I can't express just how important this video is for an aspiring game developer who kinda slept through his physics classes ngl.

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

    Hi! I really liked your guide! I understood about 10% the first time. I'll watch it again to understand more. Thanks for making this for beginners.I'm working as a full-stack developer for years, but I dream to be a game dev once a while. Your guide is a great help for my projects.
    Do you also live-stream your work? I would love to see you doing game development live. Thanks again for your great work!

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

      Hi! First of all, thanks for watching and leaving a comment. I really appreciate it. And about the live streaming, I have never done it but I have always had that idea in the back of my head once the channel takes off a little bit more. My thing is that if I did it now it would be a lot of work on my end for like probably 10 people to watch, so it doesn’t seem worth it to me to do it now. But I’m glad you would watch live!

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

    Thanks a lot!! Just watched your pixel art video and i need to say I'm loving your channel, bro!!

  • @gregorynelson1568
    @gregorynelson1568 4 місяці тому

    At about 29:50, you are comparing an estimated terminal velocity between a 5kg mass and a 10kg mass while using the same b coefficient, coming up with Terminal velocities of 612.5 m/s and 1225 m/s respectively.
    However, given similarly shaped and density object of different masses will not share the same cross-sectional areas when moving through a fluid medium. If object 2 has twice the mass of the first object, then the cross-sectional area is about 58.74% more than object 1.
    (Or more simply, an object of 8× the mass will have 4× the cross-sectional area, all else being equal).
    So, in part, you are correct in that it didn't get close enough to the terminal velocities in Galeleo's testing, but also the change in cross-sectional area was not taken into account when using a constant b term.

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

    That's my friend is a golden standard of the gamedev content

  • @jaysol191
    @jaysol191 4 місяці тому

    This video is amazing and I’m genuinely learning so much

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

    A good tip when it comes to calculating things for working with kinematics is offsetting.
    Don't bother calculating things in their own reference frame, do all you calculations assuming more favorable conditions (start at the origin of the axis, and move along a single axis, and not along some combination of a couple of axes).
    Then add the appropriate offsets to the results, this back and forth conversion may not be the most efficient, but it will help your calculation a lot.
    For example, having something move on a circle goes something like this: *(x₁ + x)² + (y₁ + y)² = R²*
    Where x₁ and y₁ are constants, the position of the circle's center.
    But that's a hard calculation, so we offset to 0 instead.
    Assume x₁ and y₁ are 0, you get a simpler equation: *x² + y² = R²*
    Then whatever result you get, you add the offset to that, and you're golden.

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

      yes that is a very good tip!

    • @alansmithee419
      @alansmithee419 10 місяців тому +1

      The equation of a circle centered on the origin is x^2+y^2=R^2
      x^2*y^2=R^2 gives an odd star-shape. I'm sure it has a name but I can't be bothered to look it up right now.
      Edit:
      From this the general equation is (x - x1)^2 + (y - y1)^2 = R^2
      Where the centre is at (x1,y1).

    • @MaxIzrin
      @MaxIzrin 10 місяців тому +1

      @@alansmithee419 Yes, my bad.
      I'll edit it.

  • @mikeorioles
    @mikeorioles 4 місяці тому +1

    Great refresher-thanks!

  • @ashishawasthi4350
    @ashishawasthi4350 7 місяців тому

    This kid is God sent to me …. Thanx buddy …. U r a genius …
    It’s exactly what I needed… thanx

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

    I learned more from this video than I did in 9 weeks of college Physics (currently, as of writing this comment, we started going over momentum and impulse forces, but neither me nor any of my classmates understood anything in the class before this point, lol)

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

    I rarely find video tutorial about physics for game Dev, I'm looking forward to more physics stuff for game dev if there's more to it or probably separate videos for each topic with additional or much detailed tutorial regardless this one is still good.

  • @Sweet-z8m
    @Sweet-z8m 8 місяців тому

    This video is deadass just my AP Physics 1 class lol. Awesome vid!!!!!!!

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

    This was very good. You are a fantastic teacher also. Thanks for the effort.

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

    Decided to check this video out because im learning physics by myself and sometimes coding a primitive ball physics simulator. It was really helpful, thank you. Also you're cute. Subscribed.

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

    very usefull information, underrated video

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

      Glad you think so! Make sure you share it with others who you think will find it useful so it will become un-underrated!

  • @LordBeef
    @LordBeef Рік тому +4

    Great video! One minor mistake is saying that -9.8m/s^2 is g. g is 9.8 m/s^2, so -9.8m/s^2 is -g.

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

      Thanks for the correction! I always mess up with that one lol.

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

      This has to be the pettiest correction ever...
      When people say g = -9.8m/s/s, it's beyond obvious that it's in reference to the 2nd derivative of displacement relative to the normal of the surface of the Earth in the Newtonian paradigm; ie. falling. The negation is clearly using the reference frame of someone stood on the surface of the Earth for the scalar; a very human perspective.
      So unless the usage is a constants library for onboard interplanetary exploration navigation software then there's no reason not to glance at it, understand what's meant and roll with it.

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

      @@davidmurphy563 I know what's meant, but it is something my physics professor would mark us down on. For a video about correcting common mistakes in game physics, I figured it was worth mentioning that g is an unsigned value.. I did say it was minor, after all.

  • @Rptr797-wn4iu
    @Rptr797-wn4iu 8 місяців тому

    After a long day of chores, school, and boredom I wanted to learn some more c# and I saw this video, I already had a head ache this just 100Xed it

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

    The reason a bounciness of 1.0 causes the ball to bounce higher over time is because of how collision detection works. The ball is simulated with a fixed time step, and eventually it intersects the plane. When this occurs, the velocity is reversed, but its position is also "snapped" to be above the plane so it doesn't appear intersecting. This small change in position without an accompanying decrease in velocity is what adds energy to the system and causes it to bounce back higher.

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

      Ahhh that makes a lot of sense, thanks for clearing that one up for me :)

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

    38:30
    My guess as to why this happens would be that when unity detects the collision of the ball hitting the surface it bounces from, because the ball's position and velocity are updated discretely between frames, the ball's position and velocity can be updated to a point that places the ball inside the object and the collision is detected pushing the ball back up out of the object it would otherwise have entered, but the velocity is not recalculated. I.e. the ball now has as much velocity as it would have had had it continued falling a tiny distance extra into the surface of the object, but is positioned at the surface of said object. The bounce is then processed, flipping this higher velocity into the upward direction.
    This can happen on every bounce, gradually increasing the energy of the ball.

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

      Inaccuracies are caused by floating point error (so exact calculations are doomed to begin with) and time steps being discrete. Collision resolution behavior depends on the closing velocity of the colliding objects. I *think* at the bottom the system is more likely to lose energy because we are not using the real impact velocity but a velocity from 16 ms or so earlier. For the same reason we are always overshooting a little bit at the top, so if I am correct that is where energy is added to the system. We could relatively easy measure this for science - and it is possible that the system might get lossy instead if the variables are different - but it does not really matter since we should always be damping to make errors irrelevant. If we need a more stable system we could calculate the positions in absolutes instead of relatives (which does not really work for interactions) or see that we occasionally "correct" the values to a default or maybe have a constraint that keeps the energy consistent.

  • @ArchonLicht
    @ArchonLicht Рік тому +4

    Great physics refresher video. Not sure what all the videogame stuff is about :D

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

    it might help someone, so i’ll mention it. velocity is speed AND direction, whereas speed does not regard direction

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

      Precisely speed is the scalar and velocity is the vector. Speed is also the magnitude of velocity.
      Thanks for putting this up because I think I just said they were similar in the video and didn’t elaborate oops 🤦‍♂️

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

      you know what is funny, only in english :)

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

    Awesome Content 🔥 THANK YOU SO MUCH!

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

    why do you add add 0.3 to the 0.74 value in the friction constant calculation in 24:07

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

      At 22:47 I shows that the box has a static friction of .3 in the physics material, and the red surface has a static friction of .74 set to average. That means the .74 and .3 get averaged together to get the coefficient of friction in the actual friction calculation. So (.74 + .3) / 2 = .52

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

      @@WillHessGameDev thanks

  • @0xF81
    @0xF81 Рік тому

    42:15 "zero equals one" and that huh sound with "?" symbol 😂😂 funny haha, and overall great video, thanks a lot for making it! ❤

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

    As a curiosity more than a correction, gravity decreases slightly the higher you are from earth's surface. Gravity is partially defined by the distance between the center of 2 objects but since earth's radius is very large we can discard any height (distance from earth's surface) and say that gravity is 9.8 mostly always when working with relatively small units.

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

      Very true. g = GM/R^2 where G is the gravitational constant and R is the distance to earths center, and mass is the mass of earth. Plugging stuff in at sea level I believe is where the 9.8 comes from!

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

      @@WillHessGameDev It is indeed!

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

    Drag should be proportional to velocity squared. The drag equation clearly states v^2.

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

      I 100% agree with you on that and I have no idea why it isn’t. My physics textbook used that equation with -bv as an equation for any “resistive force”. They just said it was air resistance, which confused me because I knew there was this long formula for it. I was messing around with reading velocity data for different falling objects in unity and low and behold they use this dumbed down version of drag too! Idk why it can’t be dumbed down but keep the square…

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

      @@WillHessGameDev Perhaps what they mean is rolling resistance or friction based resistance, they scale linearly with velocity.

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

    38:20 you said you do not know why the dark green ball bounces higher the more it bounces. I THINK the reason why is the gravity will make the force at which it is moving down more so then it will bounce higher.

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

      Idk if I understand you theory completely, but it sounds like you are saying that the force being exerted on the ball is higher when it is closer to the ground. I know that’s how our brains like to think of it because the ball is moving faster so there should be more force, but remember that force is related to acceleration and not velocity, so the force gravity exerts on the ball doesn’t change!
      A bounciness of 1 should be a collision where no energy is lost, so if we do a bunch of math and cancel terms, we would get that, but computers don’t think like that. They just plug stuff into an equation and compute the answer which could lead to rounding errors if they used a velocity that wasn’t perfectly accurate. That’s my current theory, and something I would blame all of my slight inconsistencies whenever doing physics, rounding errors lol.
      I have no definitive proof that this actually is the reason though…

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

      ​@@WillHessGameDevI have thought more about this. I THINK that the reason for it bouncing higher is the force in applied for going down but only a fraction of that force is needed to hit the ground. then Unity makes it bounce at it's full power including the fraction that was not needed to make it hit the ground. which would explain why it only bounces a fraction more every time. but I could be wrong.

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

    i accualy want to develop games will this video be enough for the whole game physics sector? please reply.

    • @WillHessGameDev
      @WillHessGameDev  4 місяці тому

      I definitely depends on what you are looking to get out of game dev. If you are trying to make your own engine then probably not. This video is the basics of Newtonian mechanics and how to use it in unity. If you are unity specific, then this video is most likely going to be enough, but if you use another game engine you might need to do additional research on the topics discussed here. All the topics should be the same though as physics is physics no matter what game engine you’re using. If you’re making your own engine you should already know how to do this stuff or start learning because a one hour video isn’t sufficient for making an entire engine

    • @gamerneshabdofficial1102
      @gamerneshabdofficial1102 4 місяці тому

      @@WillHessGameDev i shall use unity.

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

    Nice! Thank you for this!

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

    thanks a ton for this, it's very helpful for learning topics

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

    Brother u made me like physics again

  • @물개친구수달
    @물개친구수달 6 місяців тому

    18:12
    Break(GetEquilibriumForceMagnitude(Mathf.Deg2Rad * transform.rotation.x));
    transform.rotation.x is the x element of the quaternion, why are you multiplying it by Deg2Rad?
    What does this mean?

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

      Deg2Rad is a constant (pi/180) and you multiply it by an angle in degrees to get the angle in radians. The function took in a radian value as an input so that’s why I did it.

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

    Well done. A great tutorial.

  • @theashbot4097
    @theashbot4097 Рік тому +4

    I am been trying to make a simple version of unity physics (because I do not need all the realistic stuff). I did not realize that physics is that complicated.

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

      It is just a LOT of math. If you don’t mind me asking, is the “simple version” in unity? Or is it like a separate physics engine? I say that because if you are trying to make a simple physics engine you have one very hard topic to learn, collision detection and coming up with a good algorithm for that.
      If you were talking about just using physics in unity to make stuff move around, I’ll give you the TLDR.
      - use fixed update for forces that act over time
      - use forceMode.Impulse for forces that happen instantly (or if you aren’t concerned about realistic-ness you can use forceMode.velocityChange)
      -change an object’s mass to make it more or less “influenced” by the force you act on it
      Hope that helped and feel free to ask any questions!

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

      @@WillHessGameDev I am gust trying to make a light weight version of the unity physics. All the "physics" that my "physics engine" will have is Gravity, Collision Detection (Using unity colliders, and Physics.Overlap____), ground checking, fake velocity, fake drag, slopes. the drag, and velocity is even more simple then what you explained in the video.

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

      I amm planning on adding force when colliding with things though.

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

      Cool, well if you get stuck feel free to reach out!

  • @christopherfrancique9912
    @christopherfrancique9912 22 дні тому

    thanks bro, so clear

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

    This is a pretty good tutorial, thank you. It’s well detailed. Can you make another version in the future that does everything from scratch (assuming we already have a simple and basic 3D renderer already in place, no game engines)?

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

      Ignore the hyper link that youtube added in a recent update, worst feature ever made. Someone needs to sue the company.

  • @fjohnson-o4t
    @fjohnson-o4t Рік тому +1

    Great video, subed ^^

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

    Great video. Slight presentation tip - your Ts look like + symbols, which can get confusing. Might want to draw them with the tail t.
    I have the same problem with my r's and c's as I habitually curl my r a small bit at the bottom.

    • @WillHessGameDev
      @WillHessGameDev  10 місяців тому +1

      The worst for me are my 2s and Zs, they always end up looking identical lol. Thanks for the advice!

  • @ЭдуардСухарев-ш9ч
    @ЭдуардСухарев-ш9ч 6 місяців тому

    Why at 2:40 are we taking 1/2 of the acceleration times time squared? Why is it only 0.5? Should it not be just 1 (e.g. no additional multiplication at all)

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

      I thought the same thing when I started learning physics. It has to do with integration (calculus) which is the area between a graph and its axis. With a constant acceleration, the acceleration vs time graph (acceleration on y axis and time on x axis) will be a straight horizontal line because acceleration doesn’t change. Integrating acceleration gives you velocity so the area between the acceleration line and the x axis with the times as bounds is the area of a rectangle, length times width. Length is the final time, t (assuming you start at t = 0), and width is just the constant acceleration, so v = at. The graph of that is a linear function that passes through the origin with the slope equal to the constant acceleration. The integral of velocity is displacement (position) so we find the area between that line and the x axis, this is a triangle so the area is .5 * base * height. Our base is again t and our height is v which is at, so the area is .5 * at * t which means the position is .5at^2. It’s a bit confusing but I hope that made sense! If you have any other questions or need me to explain this better lmk!

    • @ЭдуардСухарев-ш9ч
      @ЭдуардСухарев-ш9ч 5 місяців тому

      @@WillHessGameDev oh, right! It took me time to wrap my head around your explanation but now it's clear, though pretty much counter-intuitive if you think about it without graphs

  • @n1i_k
    @n1i_k 5 годин тому

    28:10 mistake: the drag force should be equal to -b * velocity **squared**

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

    thanks brother this video is like a life saver

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

    Correct me if I am wrong, but I think your saying of “the force that counters gravity” is a bit misleading... The definition of a normal vector is one that is perpendicular to a surface, which I think is fairly descriptive. On the other hand, what you are describing seems more like the positive y component of a force vector, which in general is not the same as a normal vector.
    Other than that, this is a great video, and I’ll be following along to integrate physics into Unity. Thanks!
    Edit: I noticed you misspelled “braking”, lol.

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

      I totally agree that the actual definition of the normal force is more accurate, but I feel like a lot of complete beginners would start freaking out if I said something more technical like perpendicular to the surface. That is definitely a better definition if you know how vectors work, but with friction on a flat surface, referring to a normal force as the force that counters gravity is sufficient in my opinion. But yeah it is a little misleading when talking about normal forces and normal vectors in general, because they don’t necessarily have to be caused by gravity in the first place.
      Thanks for watching and leaving the little correction!

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

      Lol I am terrible at spelling so to only have 1 noticed spelling error isn’t too bad!

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

    Best video there is 💪

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

    Conceptually position is not a vector. It's a point. It just so happened that both vectors and points can be represented by tuples of numbers. In fact, each vector consists of two points: a starting point and an ending point. We just omit the starting point assuming it's in origin (0,0).

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

      I might be wrong about this one but I’m pretty sure “displacement” is the vector, distance is the magnitude and position describes the point in space. I think…

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

      @@WillHessGameDev yes, displacement is a difference between final and initial positions, so it's a vector.

  • @codexed-i
    @codexed-i Рік тому

    You are awesome❗ Keep up the good work❗

  • @dev-dev-dev1
    @dev-dev-dev1 5 місяців тому

    Amazing video! It really helped me understand physics better.
    Thank you!
    I have recommended it to my friends several times, but some of them struggle with it due to their limited knowledge of English (we are not native speakers).
    Could you please let me know if I can create an AI translation and share it publicly (of course, with proper credit to you and without monetization)?

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

      Yeah totally, again as long as you credit me that’s totally fine

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

      Also thank you for asking before you did it! If you wouldn’t mind sending the link so I can pop it in the video’s description too to help other people too, that’d be great!

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

    Recommended this video to my friends.

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

    Great video! Thanks a lot

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

    At 16:12, I don't understand why that angle is 90 - theta and the adjacent angle is theta. And at 16:25, the normal force is equal to mg.cos(theta). Do you have any videos that can explain these concepts? (sorry for my english if u didn't understand.)

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

      ua-cam.com/video/ufgY237M5KQ/v-deo.html this guy is really good and he answers your question in the first 3 minutes of the video!

  • @Maksimka-vc8fw
    @Maksimka-vc8fw Рік тому +1

    Great job, appreciate it.

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

    29:47 that's probably because of the shape, if you throw a sheet of steel and a sheet of paper they won't fall at the same speed because of the air AND the shape, but 2 balls will need a much greater distance to be able to see a diference
    Either way if there is no air everything just falls at the same time

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

    Probably mentioned in the comments, and maybe something you clarified somewhere deeper into the video, but acceleration is more correctly defined as a change in velocity and/or direction. So you could be traveling at constant velocity in a circle (constant angular velocity), but you are accelerating.

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

      Yes that is 100% true, but I don’t think anything was incorrect about my definition. I believe I defined it as the change in velocity over the change in time. Velocity is a vector quantity so it has both direction and magnitude. I’m the case where the object is traveling in a straight line, direction stays constant and the magnitude changes, but in a circular path, an object traveling with a constant speed will accelerate towards the center of the circle. This is called centripetal acceleration and is a whole other topic I didn’t mention in the video, but the tldr of circular motion is that a=v^2/r. If I said acceleration was the change in speed over the change in time, then that would be wrong because it defies circular motion. I thought all of this stuff was too confusing to discuss in the video and make people click off because they were too confused, but yeah.

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

      @@WillHessGameDev Apologies, you are correct.

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

      Lol no need to apologize, you are also correct. The beauty of physics is that there are some things that are just needlessly confusing where we can be talking about the same thing and not even realize lol

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

    I stumbled onto this video yesterday as I've been researching game physics for a physics-light helicopter game I'm working on. The engine I'm using, Godot, does a terrible job of simulating drag, but I didn't fully understand how I would apply your approach (Fd=-bV) to Godot. Is -b just a "best guess" value?
    I plan to do some experimentation and see what feels right, but my goal is to choose values and build a simulation that works with realistic properties applied to the helicopter assets I build AND to allow modders to add their own helicopters to the game without them having to do extensive math, just using a sane value for the mass, making sure the center of the node is the intended center of mass, and maaaybe having them calculate the center of pressure/drag and place a Node3D there.
    Okay, this is getting long and I apologize, but I really want something that's realistic yet accessible for players and modders alike. Any guidance you may provide is appreciated. My experience with physics is basically just intuitive (playing KSP) and struggling to help my son with high school physics. lol

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

      Yeah that -bv for drag isn’t the most accurate way of doing it, if you can and are trying to make things ultra realistic you’d probably want to use the more complex equation. It’s a bit more cumbersome and you’d need the cross sectional area to make it as accurate as possible.
      The b can be calculated from your best guess at the objects terminal velocity.
      Sorry it wasn’t a great answer but drag is very complicated to do 100% realistically

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

      @@WillHessGameDev No, you're good. You could do another video much longer than this one just about calculating drag. I have a few ideas about how I might approach the problem by using a shader to get the reference area and working backwards from maximum airspeed to work out the drag coefficient. It's not a perfect solution, but once I have some numbers that are more or less working for me I can do some testing and at least make something that doesn't break the illusion for the player.
      Thank you, BTW, for this video. Really helpful stuff.

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

      As much as I love physics, a super long video just on drag would likely not perform well. I’m thinking about making more of a video series with all the main parts of this video as their own separate video, and showing implementations in unreal and godot as well, so for the drag video, I could go into a bit more detail. However it will not be anywhere near the length of this video lol. Thanks for watching!

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

      @@WillHessGameDev that's a great idea. I hope it's well received. I certainly wasn't suggesting you should make a super long video on drag, lol. Just saying that's what it would take to discuss it in depth.
      I'm no UA-camr, but once I have a serviceable solution I might write something up on GitHub in hopes that it may help someone else.

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

    4:32 wouldn't the balls hit each other before they hit the ground, since because of the ball mass of 100 000 000 kg, it would accelerate the ball of 1kg, which is ~30cm away from the heavy ball (their centers), it would accelerate at 7cm per second per second, which would mean that if they fall for atleast 2.5 seconds, the distance between them would shrink to 0. Though it still doesnt change the point that they would hit the ground at the same time, so this is kinda useless.

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

      I just used big numbers and small numbers to demonstrate the fact that the balls fall together. It was kinda a silly example and a dumb excuse to talk about the balls of a long dead scientist…

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

    very good but I wish you would have talked about verlet RK4 and Triangle collisions

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

      Thanks for watching. I'm gonna be honest IDK what that stuff is so that's why it wasn't in the vid

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

    "Leaning tower of pizza" made me lol.
    Superb video!

  • @Sofia-rh7ji
    @Sofia-rh7ji Рік тому +2

    With your section on Friction, while what you said is entirely accurate, I would like to point out that constant friction, despite being the most accurate representation, will often feel unresponsive for the player or anything that would be alive, which is why I will typically add other "friction" constants that scale linearly and quadratically to your velocity to make it feel more responsive to the player controller and the movement systems for other "living" entities.
    And while your drag section is definitely interesting, it isn't actually that computationally expensive to represent the drag much more accurately, so, while it makes sense to represent it like that for most games, I typically will make my physics systems work off of -bv^2 for acceleration because it drives me crazy when I know that I implemented something innaccurately.
    Also, if you're implementing your own collision processing, it's actually a lot simpler than you would think, with varying elasticity essentially just being an interpolation between perfectly elastic, and completely inelastic collision. Completely inelastic collision can just be represented as taking the total momentum and dividing it by total mass to get the mass of both objects, and, though slightly more complicated, perfectly elastic collision can be simplified down to a few rules and isn't too hard to implement, even in 3 dimensions.
    And one thing which I think you should have mentioned would be the way in which rotational velocity is represented, because too many times I have seen friends directly modify the rotational velocity and get really weird results. So, for people interested in directly modifying rotation velocity, know that the direction of the vector represents the axis that it spins about, ie. a rotational velocity of would rotate about the x-axis, and the magnitude represents speed, so a rotational velocity would spin twice as fast. Importantly, however, this DOES NOT mean that a rotational velocity of would spin about the y-axis and x-axis simultaneously, instead, it would rotate between the two axes, which is how you can get weird gyroscopic procession when you mess with the rotational velocity vector directly. For those confused with how this works, I would personally recommend just interacting with whatever is equivalent to the AddTorque method in whatever physics engine you use.

    • @Sofia-rh7ji
      @Sofia-rh7ji Рік тому

      By the way, if you have rotation, it doesn't actually make the collision system that much more complicated, and, for a temporary fix immediately after implementing rotation to your physics engine, you can just take the velocity deltas and use those to find the impulses, and then apply them locally so that you can process those in whatever function you have to process forces that aren't in-line with the center of mass. Keyword here for this method is "temporary," though, as this is not accurate, and can make inelastic collision seem more elastic than it is.

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

      Wow that was very insightful! Thank you for leaving this. The thing with drag is that the -bv is how unity handles it and coding my own solution and explaining it in the video would definitely turn some people off so I decided to stick with how unity did it!

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

    46:50 Don't know what you meant, but radians are not 'a fraction of pi'. Pi itself is in radians, and a radian is a unit of measure.

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

    Although I liked the video just into it a few minutes, but you deserved a sub for the Galileo and his balls jokd 🤣🤣. I for sure know the video is gonna be great.

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

    Hey can u also make a video on a ultimate guide on maths for game development centered around unity like u made in this one. It would really help

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

      Definitely! With the success this video has gotten I’d totally be down to do that. I have my next few videos already planned out so maybe in a few months. Thanks for the idea!

  • @irishbruse
    @irishbruse Рік тому +6

    Dude sounds like Michael Reeves if he hit puberty

  • @uwoowoayaya
    @uwoowoayaya 4 місяці тому

    28:15 Is incorrect. The force of drag is not directly proportional to the velocity. It's directly proportional to the square of the velocity.

    • @WillHessGameDev
      @WillHessGameDev  4 місяці тому

      At 27:46 I talked about the drag equation, including velocity being squared. After that I talked about how the resistive force model dumbs everything down with the b and things not being physically accurate, just the key ideas of higher velocity = more drag. Unity uses the resistive force approach to drag which is why I showed that section the way it was

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

    This video is amazing 🎉🎉🎉 thanks

  • @5DPixel
    @5DPixel 12 днів тому

    Thanks, I’m making a game engine in Vulkan

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

    Holly math batman. I'll just stay working at the Dairy Queen

  • @DanielMatéGonzález
    @DanielMatéGonzález Рік тому

    how tf did you already do so many projects although you are so young 10/10

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

    Which book should I read ?

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

      Sorry, What do you mean by that?

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

      @@WillHessGameDev which book is good for physics for game developers

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

      I don’t know if there are any physics books designed for game developers but the physics textbook I had was the serway Jewett 9th edition I believe. Its very good but again it’s just physics and has nothing to do with game dev. If the game engines physics system is accurate to the real world it will be very applicable otherwise not so much. Oh and the serway Jewett book also goes into electromagnetism which is not needed for game dev at all unless you are trying to accurately code in magnetic fields and stuff like that. So maybe consider finding another book solely on the mechanics of books are your thing.

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

    good thing we were taught this in high school

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

    fuck me .. either I wasnt ready, or my teacher wasnt, way back when I was in school. Thanks for this easy to understand explainer.

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

    upthrust could also be something nice to add if you do anything like this again

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

    I still remember how lost I was when learning this crap in Physics in Uni. Now it seems trivial, when applying it in practice.

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

    Big shout-out to Galileo and his balls.

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

      Exactly people always credit Galileo but they forget to credit his balls too! Justice for Galileo’s balls!

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

    would you recommend any books because I want to learn more about these topics

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

      I leaned physics from an ap physics class in high school. We used the serway jewett 9th edition I believe but I wouldn’t recommend that one just because of the sheer amount of other stuff in there. It’s really good but if you are just into the Newtonian mechanics (what this video was about) then getting that textbook is crazy overkill because it goes into electromagnetism, thermodynamics relativity and probably other parts of physics that I’m forgetting about. It’s also calculus based which if you understand the calculus involved then the concepts make much more intuitive sense but I could definitely see someone who isn’t well versed in calc getting very confused with some of the problems and explanations in that textbook. It’s really up to you but look for something with Newtonian / classical mechanics and with practice problems because doing problems is a great way to make sure you understand the concepts. Sorry I didn’t have a specific recommendation but I hope that helped!

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

    now do one for graphics/lighting/rendering engine

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

      Hahahaha I totally would if I understood anything about that stuff. Maybe some day but not soon

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

      @@WillHessGameDev ill set a reminder. Really loved this video. also btw how old are you if you dont mind me asking?

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

      Thanks! I’m 18 btw