Trigonometry | Gamedev Math

Sdílet
Vložit
  • čas přidán 29. 08. 2024
  • Greatest hits of trigonometry! We learn how to apply trigonometry by exploring how to set up aiming in top-down shooters & by introducing bullet spread!
    Kahn Academy Trig series: • Trigonometry
    PROOF WE CAN USE SINE & COSINE TO SCALE SPEED APPROPRIATELY: drive.google.c...
    THERE'S A NEW DEMODAY: itch.io/jam/ag... this is the jam I've been submitting my game to, I didn't this time because I'm a little too busy (hence the math videos) but there are some real gems there--something for every taste--so check them out! Also check out Nodev Crab, who AMAZINGLY is reviewing every game submitted AGAIN: / @reviewcrab6841
    I swear, this man gets a few extra hours each day compared to the rest of us.
    my twitter: / dev_natsu
    DEMO HERE! Sic Transit on itch: natsudev.itch....
    *** MUSIC USED ***
    Mewmore - Clock Tower (Marvel vs. Capcom 2 Remix) • Mewmore // Clock Tower...
    Mewmore - Gerudo Valley (The Legend of Zelda: Ocarina of Time Remix) • Mewmore // Gerudo Vall...
    Mewmore - Layer Cake (Persona 5 Remix) • Mewmore // Layer Cake ...
    Mewmore - Elegy of Emptiness (The Legend of Zelda: Majora's Mask Remix) • Mewmore // Elegy of Em...

Komentáře • 74

  • @macha-leaf
    @macha-leaf Před rokem +33

    SOH CAH TOA!

    • @NatsuDev
      @NatsuDev  Před rokem +6

      I first took HS trig over a decade ago and I STILL do it 🤣

  • @mirandaart3012
    @mirandaart3012 Před 3 měsíci +7

    all of a sudden high school math from years ago finally clicks in (loved watching this!)

    • @NatsuDev
      @NatsuDev  Před 3 měsíci

      Thank you so much, I'm glad you enjoyed it!

  • @aldobernaltvbernal8745
    @aldobernaltvbernal8745 Před 2 lety +20

    i genuinely do not understand how a video this good can have less than 100 views (84 at the time of writing)
    this is a great intro to trig, you deserve way more recognition

    • @NatsuDev
      @NatsuDev  Před 2 lety +2

      Thank you very much, I spend a lot of time deciding how I'm going to cover each topic, so your words mean a lot to me. And why less than 100 views? I guess I gotta start posting on reddit.

    • @Afreshio
      @Afreshio Před rokem

      i don't know, the guy talks to fast and the video and speech is not in sync. this is an intro, it shoud be way slower

    • @aldobernaltvbernal8745
      @aldobernaltvbernal8745 Před rokem +2

      @@Afreshio don't forget you can always rewind if you get lost! these kinds of videos aren't usually a view-once kind of deal

  • @Leoleonpd
    @Leoleonpd Před 2 lety +12

    The algorithm recommended this to me! Thanks for the helpful video! Your channel deserves so much growth. Good on you

    • @NatsuDev
      @NatsuDev  Před 2 lety

      Thank you for your kind words, I really appreciate it--I still feel like a complete amateur at making videos so hearing that means a lot! And I'm glad you liked the video!

    • @Leoleonpd
      @Leoleonpd Před 2 lety +1

      @@NatsuDev yeah! I was shocked at how few views you had. The quality is really good.

    • @NatsuDev
      @NatsuDev  Před 2 lety

      Yeah, I have to start posting on reddit or something lol! After starting to make these I understand why companies have social media positions--it's just a lot of time.

  • @rohanvishayal8724
    @rohanvishayal8724 Před rokem +3

    Underrated af, this is quality content.

  • @dominic_sanchez
    @dominic_sanchez Před rokem +8

    This video is great. I think using motion canvas would help increase the quality but I think what you have is charming in its own way. I like how fast paced everything is and still digestible. Younger me would've appreciated this video a lot when learning about trig.

    • @NatsuDev
      @NatsuDev  Před rokem +3

      Huh! Never heard of motion canvas before--next time I make a video like this I'll give it a try. Thanks!

    • @RenderingUser
      @RenderingUser Před rokem +4

      ​@@NatsuDevmotion canvas is an epic tool made by another gamedev on CZcams
      Really cool stuff

  • @SeanFrancisNBallais
    @SeanFrancisNBallais Před 10 měsíci +3

    Almost two minutes in, and I knew this would be fun to watch while learning.

  • @user-pf9jv1fl2n
    @user-pf9jv1fl2n Před rokem +4

    So underrated Please keep making videos its so fun to watch Maths and how its implemented in games :) plus your voice is so relaxing

    • @NatsuDev
      @NatsuDev  Před rokem +2

      Thank you very much! I've got a few more math videos in the pipeline--one about Quaternions that I've been putting off for TOO LONG!

    • @user-pf9jv1fl2n
      @user-pf9jv1fl2n Před rokem +1

      @@NatsuDev Can't wait to see it :) the effort you put into your videos is extremely evident. Good job! And as I've said I can't wait :)

  • @LighthoofDryden
    @LighthoofDryden Před rokem +6

    Ok look the math was fine but I need those macarons

    • @NatsuDev
      @NatsuDev  Před rokem +2

      Sorry, but I'm afraid they're long gone!

  • @juliuswaldmann8682
    @juliuswaldmann8682 Před 2 lety +4

    I was also brought here by the algorithm. Normally I am not really the "comment writing person" but I have to say that this video was really well-made, and I had to complement you. I wish you the best of luck going forward.
    You've gained a new subscriber today :)

    • @NatsuDev
      @NatsuDev  Před 2 lety +1

      Thank you! I really did not this video to take off like it did, and I appreciate your kind wishes! I'll keep on putting out the good stuff for you!

  • @Ra11y
    @Ra11y Před 2 lety +4

    Subscribed! This video gave me the right kind of A level maths flashbacks

    • @NatsuDev
      @NatsuDev  Před 2 lety

      Perfect! I'm trying to hit the highlights of all the topics I cover and show how they can be used. I just want to inspire people who might not like math but are interested in gamedev to give math a second chance.

  • @_Egg
    @_Egg Před rokem +2

    wait what. i thought i was watching a huge youtuber until I heard at the end you were a small one. huh. great job

    • @NatsuDev
      @NatsuDev  Před rokem +2

      Haha, thanks! It was more true when this video first came out, I think back then I only had roughly fifty or so subs.

    • @_Egg
      @_Egg Před rokem +1

      @@NatsuDev very nice. just keep up the quality and youll be golden. I know and respect the grind

  • @mr_dodex
    @mr_dodex Před rokem +2

    Loved this great intro to trig.

  • @billy6427
    @billy6427 Před rokem +1

    Very much Needed

  • @xx_gotadam_xx9457
    @xx_gotadam_xx9457 Před rokem +1

    This is genuinely so helpful tysm

  • @therealaleki
    @therealaleki Před 2 lety +1

    Wow, this is a very good quality video

    • @NatsuDev
      @NatsuDev  Před 2 lety

      Pleased you think so! But Hyper Light Drifter is so stylish it might be making it seem better than it really is ;)

  • @theveryloosegoose
    @theveryloosegoose Před 9 měsíci +1

    Love the video, but one thing has me confused at about 7:20 in the video; what do you mean by using the signs(sines?) of x and y to find Theta? Every way I've thonked about it, I can't figure out how.

    • @NatsuDev
      @NatsuDev  Před 9 měsíci

      Right, so, regular arctangent only ranges from -pi/2 to pi/2, i.e. just 180 degrees instead of the full 360. So if you want to figure out the actual angle you'd have to look at the signs of x & y (whether or not they're positive or negative). Or if you're using a programming language with a math library you should have access to an atan2 function that does all of that for you.

    • @theveryloosegoose
      @theveryloosegoose Před 9 měsíci +1

      @@NatsuDev Okay NOW i think I get what's happening; you use normal arctan to get the limited -π/2 -> π/2 angle, then find out which quadrant it's in with the x and y, and then just find the angle that shares that tan with the result of arctan. Right?

    • @NatsuDev
      @NatsuDev  Před 9 měsíci

      @@theveryloosegoose you got it!

  • @brianwaltse281
    @brianwaltse281 Před rokem +1

    I may be wrong, but I believe the arc length formula given is incorrect?
    Should be s=r*angle, or s=r* (angle/180) for degrees?
    π * 1 = π so I'll remove it for the unit circle, but as an example, let's try solving for an arc length for the half circle. That could be represented as 180°, 0.5, or π.
    π*π = 2π
    π*180 = 180π (or 2π if we convert)
    π*½ = ½π
    The correct answer is a length of π of course. Or, alternatively, 180.
    I may be misunderstanding though.

    • @NatsuDev
      @NatsuDev  Před rokem

      Mea culpa! Yes, the formula for arclength in radians would be arclength(theta) = radius * theta & if you want it in degrees it would be arclength(degrees) = radius * pi * (degrees/180). I think I had a brain fart while writing out the formula while listening my VO.

  • @Preview43
    @Preview43 Před 2 měsíci +1

    I tried. I really tried.... but my brain doesn't math. I remain mathless and trig-poor.

    • @NatsuDev
      @NatsuDev  Před 2 měsíci

      Any better luck with the Kahn Academy Trig series I linked? I cover the greatest hits of Trig at breakneck pace whereas that series goes at an actually reasonable pace.

  • @macronomicus
    @macronomicus Před 2 lety +1

    Those macaroons look great! And, wow you're extremely better at math than I am 😳if it weren't for widely available reference materials & tutorials like this, node-"coding", & code libraries, I think the math stuff would be way out for me, i've spent so little time learning maths except on an as needed or curiosity basis. The way I learn I'd have to dive deep for a long time to get math properly embedded, & mastered would take many years of course. Thats why Ive always been more the type that eyeballs things & tinkers until it feels right. 😜

    • @NatsuDev
      @NatsuDev  Před 2 lety +1

      Oh don't worry, I've spent years practicing & improving my math skills and I know a lotta people who absolutely smoke me. Thankfully for gamedev you can take little bites out of math as needed & there ARE great libraries that help--I'm a big fan node coding also! Whatever lets you get the hard stuff outta the way and lets you make a game! And I'm just as guilty as tinkering & eyeballing things as you are!

    • @macronomicus
      @macronomicus Před 2 lety +1

      @@NatsuDev Hahaha! Thats great to know, thanks for the encouragement. I have dabbled in 3d for years slowly teaching myself as I get time/inspiration, the code area is wild & so unique, ive been dipping my toes into all the areas, only with learning as the goal since I dont often get the chance to use the skills just yet, except maybe in collateral & art for web projects sometimes. I hope to expand at some point though when inspiration strikes. I love seeing vid's like these because its always adding more bits to my mind map of it all. Thanks for posting & I wish you great luck with growing your channel and projects!💚

    • @NatsuDev
      @NatsuDev  Před 2 lety +1

      Thank you kindly! I'm glad I could help fill in the fuzzy parts of your mind map for you--great imagery by the way! It reminds me of how the monsters at the edges of old maps eventually got filled in with the actual geography there.

    • @macronomicus
      @macronomicus Před 2 lety +1

      @@NatsuDev Yea, that is a cool effect for a game map, there's sort of a fog covering it until you explore an area some, I think that helps drive curiosity & keep people playing with a sense of adventure of what may be ahead. I can hardly wait until I have some time to tinker in UE again, its tons of fun creating! Thanks for the inspiration man, I hope your dev stuff is going great!

  • @streamdx
    @streamdx Před rokem +1

    I think you can convert shoot direction vector to a unit vector(vector of length 1) then you don’t have to use sin and cos in order to achieve same bullet speed in all directions.
    Or may be i don’t get your idea… it is also might be computationally cheaper to normalize vector once instead of calling relatively expensive sin() and cos()

    • @NatsuDev
      @NatsuDev  Před rokem +1

      That's true, you can! But since I cover Linear Algebra & Vectors later on in this series and this video in particular just focuses on trig I didn't want to use a topic I haven't yet covered.
      As to what's computationally cheaper idk. I'm largely self-taught when it comes to CS. As long as the framerate's high enough I don't really sweat the small stuff.

    • @streamdx
      @streamdx Před rokem

      @@NatsuDev i just got your video as recommended, didnt know vectors are not covered yet

    • @NatsuDev
      @NatsuDev  Před rokem

      Oh, don't sweat it! I'm gllad you really engaged with the example problem. The earlier ones are more straightforward with more advanced mathematics.

  • @arsnakehert
    @arsnakehert Před 10 měsíci +3

    Would've been pretty funny if at the point where you're typing "circumference" you had typed "circumci..." and then corrected yourself :D

    • @NatsuDev
      @NatsuDev  Před 10 měsíci +2

      DANG! Missed the opportunity!

  • @TheBunzinator
    @TheBunzinator Před rokem +1

    Technical point, but I believe they are macarons, not macaroons. Macaroons are larger soft coconut cookies without filling.

  • @YmanYoutube
    @YmanYoutube Před rokem +1

    Wouldn't it be easier to use Vector math for the single shot instead of Trig? Just get the direction vector (mouse pos - player pos) normalized and then multiply that vector by your speed value.

    • @NatsuDev
      @NatsuDev  Před rokem +1

      That'd work & be easier for a single shot but since I also wanted to implement a shotgun-style spread as part of the hands-on demo, which requires trigonometry. Plus I cover vectors later on in the series, so I didn't want to use something I hadn't introduced yet.

  • @truelifek9221
    @truelifek9221 Před rokem +2

    Me in high school: I will never need trig in the real world. Why do I need to know this?
    Me now: Oh.

  • @DrNabeel20
    @DrNabeel20 Před rokem +1

    Great video! I enjoyed it a lot, but the background music is distracting and loud :(

    • @NatsuDev
      @NatsuDev  Před rokem

      Ah, sorry about that! I always have a tough time dialing it in properly. I'd be happy to give you a pdf of script that includes the equations & works if that'd help☺

    • @DrNabeel20
      @DrNabeel20 Před rokem +1

      @@NatsuDev thanks for that, keep making these useful videos and that is all I want 🔥

    • @NatsuDev
      @NatsuDev  Před rokem

      Here you go! drive.google.com/file/d/1cSorJdsOIFE0mcWSGR9ADJsPWp-bihtd/view?usp=sharing Let me know if you have any problem accessing the file or any questions regarding the material covered!

    • @DrNabeel20
      @DrNabeel20 Před rokem +1

      @@NatsuDev Thanks! 🌹🌹

  • @user-rt8jm3xv1d
    @user-rt8jm3xv1d Před 2 lety +1

    Great video! Keep doing this. Just smashed the subscribe button)

    • @NatsuDev
      @NatsuDev  Před 2 lety

      Thank you very much! I'll keep on doing the best I can, just don't expect a video on differential geometry anytime soon ;)

  • @octavioaxel8514
    @octavioaxel8514 Před 2 lety +1

    What languages are you using?

    • @NatsuDev
      @NatsuDev  Před 2 lety +2

      Honestly, it's mostly psuedocode but I am using the C/C++ pointer symbols. Again, I want this to be the well-meaning shove that gets you to do this stuff for yourself! So use whatever language and/or engine you feel most comfortable with!

  • @uthkarshm6390
    @uthkarshm6390 Před 2 lety +1

    e understand tNice tutorialngs in better depth. I didn't even realize i was just scratcNice tutorialng the surface with tNice tutorials DAW. I'm using soft and soft one and I