Trigonometry in Game Development

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

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

  • @atibyte
    @atibyte 4 года назад +124

    Watching videos about game dev and math is always interesting.

    • @jhonnatanwalyston6645
      @jhonnatanwalyston6645 4 года назад +23

      it's a cool way of procrastinating

    • @sid98geek
      @sid98geek 3 года назад +11

      I always hate people who say that mathematics beyond basic arithmetic is useless. It's not that math is useless, but that they don't know how to put it to good use!

    • @ZAKINGOFDESPAIR
      @ZAKINGOFDESPAIR 3 года назад +5

      @@sid98geek yeah, just becz most of them won't go into math related fields doesn't mean it's useless or can say whatever like, "I'm never gonna use these in my life, so I shouldn't study them"

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

      @@sid98geek i agree, maths is extremely useful

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

      @@sid98geek also whenever i code i always implement some sort of maths in

  • @mouseclicker4955
    @mouseclicker4955 3 года назад +54

    Can I just say, this is one of the best trig videos about game development I have ever seen. Everything is explained so clearly. Do you by chance have a video that explains trig in 3-dimensions?

    • @DaFluffyPotato
      @DaFluffyPotato  3 года назад +30

      Nope, because I haven’t used it enough to be confident in teaching it. I’ve only used trig in 3D stuff a few times.

    • @magnuswootton6181
      @magnuswootton6181 3 года назад +2

      if you get 2d down pat, then you can always fall back on it for all your 3d stuff all the time, if your orthonormal to a plane, then its just 2d, even in 3d.

  • @IceForgeOfficial
    @IceForgeOfficial 9 месяцев назад +2

    I love the way you provide great visuals when explaining certain concepts. I also love how thorough your lesson is. I thought I knew trig before, but I learned some new things. Amazing video! And great content!!

  • @Raphy084
    @Raphy084 4 года назад +17

    God
    Yesterday i needed to calculate how many pixels a bulet need to move to mouse cursor in X and Y every each frame with a velocity of x = 5 if y = 0
    And i used pythagore and Thales to solve my problem

  • @Kilogya
    @Kilogya 2 года назад +3

    This is really cool and useful knowledge. I don't fully understand it, and if you have a deeper explanation with of a foundation to build upon, I'm certainly intrigued and would definitely listen.

  • @DiceDrivenGameDev
    @DiceDrivenGameDev 8 месяцев назад

    thank you been scratching my head around arctan2(y,x), cos(x), sin(y) etc (I'm using GameMaker) this is very useful to re-enforce what I've been reading/watching and asking to chat gpt

  • @zerokun2655
    @zerokun2655 3 года назад +15

    man i study trigonometry at school and know the concepts in the video i feel smart :)

    • @pranitp.29
      @pranitp.29 3 года назад +4

      lol this is just some basic trigonometry
      advanced level trigono stuff is much harder

    • @doclouis4236
      @doclouis4236 2 года назад +2

      @@pranitp.29 So advanced trig and calculus are required in order to be a good game programmer, right?

    • @doclouis4236
      @doclouis4236 Год назад +1

      @r - Action RPG
      - Platformer
      - 3D Beat Em Up
      Which one of these?

    • @doclouis4236
      @doclouis4236 Год назад

      @r Oh boy, probably one of my least favorite subjects and I apparently have to re-learn in order too be a game dev. If I can use a calculator or computer, then do I still need to learn any forms of trig or calculus?
      I'm okay Math and Algebra, but those other fields are going to really rattle and stress out my brain especially when I also want to do graphic design, art, and animation.
      If I even manage to learn all these fields that I want to excel in, I feel like it's going too be hard to juggle them all and I'm going to end up spreading myself too thin as well as being a jack of all trades and master of non.

    • @doclouis4236
      @doclouis4236 Год назад

      @r Again, I want to mention I want to do art as well as nice hand drawn animation to some extent, but I don't know if I will remember all of this on top of learning to be a game dev and remember trig/calculus.
      The thought of me wanting too be good at all these fields does give me anxiety knowing the amount of time as well as attention needed to learn and maintain memory of all these things if I do go forward with learning them either self taught or in college (maybe that's not such a good idea considering student loans).
      Either way, I feel like I'm going to have very little free time. Though, this is also to say whether or not I will I be successful learning any of what I want.

  • @8-bitsteve500
    @8-bitsteve500 3 года назад +7

    Well.. I got to 53 seconds in before I was utterly lost. hah

  • @Plasterdeath1848
    @Plasterdeath1848 4 года назад +9

    yoo, thank you for this video, can you please make videos on particle effects as well as adding pixelated/drawn backgrounds

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

      I'll probably do the particles at some point, but backgrounds are just blitting an image before everything else.

  • @cauchy_math
    @cauchy_math 4 года назад +9

    First!
    i absolutely love ur vids theyre so useful
    could you please make a vid about basics of pixel art?

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

      I might do a video on this. I didn't want to for a while because I didn't feel like I had enough to add, but I think I could make a decent video on it now.

  • @watchingwolf8092
    @watchingwolf8092 Год назад +2

    I use this for a circle but I was stuck in trajectory calculations so ..... A huge tanks to you

  • @unknownuser6757
    @unknownuser6757 Год назад

    Driving home in gta5 and listening to the music at sunset 🌅 got me interested in learning trig for games. Like you could have fun learning and put it in a great game.

  • @cjdlegendary1795
    @cjdlegendary1795 7 месяцев назад

    Yeah, I know what someone will say the moment I ask this, " Just take the angle and subtract/add 180 for it to be flipped ",
    Doesn't work because although it'll flip it in the opposing direction, it will not add/subtract 180 degrees from any NEW angle made, so let me ask the question in hopes for an answer that works.
    Alright,
    So I'm attempting to take the angle of two objects,
    I want one object to flee from another.
    what I tired doing was:
    cos(Enemy.X) & sin(Player.Y + pi)
    ( according to google, + pi is the equivalent of going negative, or in other words, the opposite direction )
    however, when I run this through, it causes my enemy's path finding to go at a Up-Right angle, I presume this is for the same reasons stated 5:53
    I have never done trigonometry but painfully Construct 2 and Construct 3's path finding behavior don't have a means of path finding away from a position, only towards it with simplicity.
    So I have to write a formula within its pathfinding condition which it has two inputs ( Desired X cords ), ( Desired Y cords )
    I am forced to specify the X component and Y when writing, C3 offers a Javascript functionality but construct 2 does not, and I do not have a license for C2 so humor me.
    Construct 2-3's forums from multiple users state its "impossible" to make the pathfinding behavior flee from a given point, I don't agree with this and I managed to partially get this to work with a clamp(Player.X/Y, Enemy.X/Y) which has only one draw back, being that anything within the range of a bottom right corner doesn't return a new path, causing the AI to pause unless it breaches that angle
    Also, I am _quite_ sure I can do this with a simple math formula, and C2-C3 offers all the trigonometry expressions required to get this to work; So I think those comments stating it's impossible have simply never tried this route.
    V **QUESTION SUMMARY TO BYPASS ALL THE RAMBLING ABOVE** V
    if I were to write a formula which uses the player as a point to FLEE from, how would I write that in a way that _ISN'T_
    " Player.X/Y - 180 " or " Player.X/Y + 180 "?
    My goal is to make a cowardly pathfinding behavior, one that flees from the player if they get too close.
    The distance is already accounted for, as that is part of the condition for the event to be fired in the first place; So if possible don't include "* Distance" to your formula.
    Thanks in advance for anyone who finds this comment, I realize I am asking someone on the internet to do my 'homework'; But this has genuinely left me stumped regardless of what I've tried.
    And yes, I did try to learn Trigonometry, I understood it within the 3 hours I did research on it, or at least, have a rough understanding of it.

    • @DaFluffyPotato
      @DaFluffyPotato  7 месяцев назад

      A flipped Y means you need to make either your angle or your sine output negative to correct it.

    • @cjdlegendary1795
      @cjdlegendary1795 7 месяцев назад

      @@DaFluffyPotato Doesn't seem like its required, Upon flipping sin or angle to negative
      I get the opposite results to just keeping it positive.
      Enemy moves towards you if you move toward it, and vice-versa away from it.
      So I have my sin and angle untouched, I think this has to due with the fact C2 unlike most engines has its 0,0 point start from the bottom left corner rather than the top right.
      But atlas I could be wrong.
      Thanks for the quick reply

  • @eleos5
    @eleos5 2 года назад +2

    Well paced, visually pleasing, good examples, good video!

  • @hm4266
    @hm4266 4 года назад +6

    Super useful!

  • @RasamRohit
    @RasamRohit 9 месяцев назад +1

    So you have used
    x += cos(direction) * speed
    y -= sin(direction) * speed
    But isn't this also the formula for circular motion
    x = x*cos(direction)-y*sin(direction)
    y = x*sin(direction)+y*cos(direction)
    Can anyone explain how are they the same??

    • @TheSaintsVEVO
      @TheSaintsVEVO 4 месяца назад

      Are you sure that’s the formula for circular motion? Did you mean something like: x2 = distance*sin(direction) + x1, and y2 = -distance*cos(direction) - y1

  • @qzorn4440
    @qzorn4440 10 месяцев назад

    Great trig information. 😎 Thanks.

  • @kevinw5539
    @kevinw5539 4 года назад +6

    what is your favourite palette on aseprite? thank you.

    • @DaFluffyPotato
      @DaFluffyPotato  4 года назад +11

      I make most of my palettes.

    • @zackydev
      @zackydev 4 года назад +5

      @@DaFluffyPotato the professionalist Lol

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

    I like to do game development. But I'm always afraid with trigonometry shit cuz im very bad at math

  • @slamsandwich19
    @slamsandwich19 2 года назад +1

    what did you use to make this video btw just curious

  • @basicallybrand
    @basicallybrand 3 года назад +5

    I am 11 years old and I can proudly say that I didn't understand a single thing. I really wanna something to my python game, but I don't know the math for it. I am sad. pls help

    • @premlalmahto2997
      @premlalmahto2997 2 года назад +2

      Learn trigonometry first.. you can learn it from RUclips

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

    Thank you, many times.

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

    its cool getting rid of the sqrt, but people will delete your code if you put it on the internet unfortunately.

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

    dude, I love this video, great, great work

  • @Byynx
    @Byynx Год назад

    Great video !!!😊 Very clever.

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

    Nice vid

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

    Thanks nice vid but i feel some things were overcomplicated tho its probs just since i learnt it different in school, just like writing a squared = b squared + c squared woulda made me get that part faster

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

    how to make the object facing mouse pleaaaaaaaaaaaaaase

  • @olivercharles2930
    @olivercharles2930 Год назад +1

    i am way too stupid to get trigonometry

  • @dimitrijekuzmanovic5792
    @dimitrijekuzmanovic5792 4 года назад +3

    Hello there

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

      General Kenobi

  • @Inevitably_forget
    @Inevitably_forget Год назад +1

    Don't mind me, just looking for a reason not to say "Fuck math"

  • @Raja-iq5pn
    @Raja-iq5pn 4 года назад +1

    size doesn't matter

  • @Fullrusher
    @Fullrusher 3 года назад +5

    Discouraging :-/

    • @wh0d1s-l
      @wh0d1s-l 3 года назад

      what, how?

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

      @@wh0d1s-l this is super complex to me , it’s been years since I’ve been in a math class and frankly can’t remember any of it lol

    • @wh0d1s-l
      @wh0d1s-l 3 года назад +2

      @@Fullrusher what is so hard for you in this, if you face problems you can come into the discord server.

    • @phoenixehc
      @phoenixehc Год назад +1

      @@Fullrusher What helped me was to write it all down in simple steps 1 by 1. Jotting down all the key words with definitions

  • @vedanshyadav-ye8bx
    @vedanshyadav-ye8bx 6 месяцев назад +1

    Please make video in hindi😊