Trigonometry • Math for Game Devs [Part 3]

Поділитися
Вставка
  • Опубліковано 9 тра 2024
  • triangles - are they for you? find out in this angular journey through trigonometry
    If you are enjoying this series, please consider supporting me on Patreon!
    🧡 / acegikmo
    00:00:00 - Intro
    00:01:10 - Asgmt. 4 solution (Bouncing laser)
    00:09:36 - Asgmt. 5 solution (Mesh surface area)
    00:30:28 - Asgmt. 6 solution (The turret)
    00:44:31 - Angles
    00:50:43 - Radians
    01:01:47 - Cosine & sine
    01:20:14 - Tangent
    01:47:24 - Angle to vector
    01:51:17 - Vector to angle
    02:04:07 - Angle between vectors
    02:25:31 - Questions
    02:31:46 - Solving triangles
    02:38:48 - Camera FoV example in unity
    02:52:19 - Determinant
    Assignments:
    Asgmt. 7 (Regular Polygons)
    Asgmt. 8 (Adaptive FoV)
    docs.google.com/document/d/1N...
    Originally streamed as a course for students at futuregames.se/, who were super kind to let me both stream this live as well as upload it here! so massive thanks to the people at FutureGames!!
    💖 Patreon ❱ / acegikmo
    🐦 Twitter ❱ / freyaholmer
    📺 Twitch ❱ / acegikmo
    💬 Discord ❱ / discord
    🌸 Instagram ❱ / freya_holmer
    ✫ Video Production by Higher Vision:
    ➥ / highervision1
    ➤ Edited by Stelly: / stelly47050876
  • Наука та технологія

КОМЕНТАРІ • 118

  • @usoppgod8107
    @usoppgod8107 3 роки тому +64

    This is gold. Literally gold for game developers.

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

      This is max enchanted netherite.

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

      this is just high school borderline middle school maths, are game developers people who didn't even attend high school ? I'm confused

    • @Pandorarl
      @Pandorarl 6 місяців тому +2

      @@Inquisite1031a bunch of people including me have not yet completed high school when learning game dev. also a practical understanding of the theory you cannot get from simply solving textual problems

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

      @@Inquisite1031 You should realise that most of the middle/high-schools in the world are total crap. And have horrible teachers and/or education curriculum. ESPECIALLY for math.

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

      @@ScienceDiscoverer I mean sure, but u still have to pass ur exams, and the vector algebra and trig u need to learn for that is pretty much what the video covered, maybe slightly less, in my country as far as compulsory education is concerned I expect every1 to know basic trigonometry and basic vector algebra, well that was like 15 years ago, maybe it has changed, xdd

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

    Extra Timestamps:
    25:57 - Volume
    28:26 - Alt method: Volume/Area using coordinate axis
    59:14 - Arc Length practical example
    1:26:32 - Trigonometry example: Camera FOV
    1:29:53 - atan, algebra
    1:33:41 - Other inverse trig functions (acos, asin)
    1:35:41 - cotangent
    1:36:56 - More visual examples (sin, cos, tan)
    1:41:35 - atan2 initial explanation
    1:53:46 - Why not acos and asin? (Vector to Angle)
    2:03:12 - Sign of an angle
    2:10:44 - Look trigger example
    2:19:17 - Visualizing the look threshold (Look Trigger example)
    2:49:32 - More FOV use-case examples
    3:02:07 - Determinant details
    3:04:18 - Signed Area Explanation

  • @hadarnesher
    @hadarnesher 2 роки тому +4

    When i just want to relax and learn and get motivated i watch your lectures, so useful and I'm not a game dev, I'm a 3D artist but everything you teach can be applied so thank so much. I will be glad if from time to time you will show 3d implementions cuz something its harder to think about and sometimes it can not be implemented the same way.

  • @kerrybrown1192
    @kerrybrown1192 3 роки тому +9

    "anyway, I went off on a tangent ... "
    very punny, and delivered with a straight face :)

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

    Thank you for this content!! I have been struggling on some math for several weeks now, never touched trig in my life and you were able to help me with the math I needed for my functions!! Amazing!!!

  • @voyageruk2002
    @voyageruk2002 2 роки тому +7

    Thought I'd use this video as reference as I'm learning geometry nodes in Blender 3. Ended up watching the whole thing non stop, it was very informative and your delivery is excellent.

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

    Finally made it to this one. Between studying the heck out of Blender, deep diving into this course taking a lot of notes, and learning the the building blocks of Unity and Unreal, I am completely swamped!

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

    Just found your channel, and it's SO helpful!

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

    I'm getting back to my high school's math teachers and tell them that Pi is a piece of garbage, and now I have a really good argument and explantion of why it is.

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

    Thank you so much for the course!

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

    Thanks so much I now have better understanding about angle or just game Dev maths

  • @antonbashkin6706
    @antonbashkin6706 2 роки тому +17

    Damn, you're the future of math learning/teaching, this is incredible work

  • @realcygnus
    @realcygnus 2 роки тому +5

    Radians: PI/2 = 90deg & PI = 180deg etc., is often thE MOST intuitive way of working with things in math/physics that involve circles/rotations/angles IMHO. PI's always manage to come back & bite regardless. Funny you mention plain old turns, I have used them myself but, don't recall ever seeing it used in any libs or anything I ever encountered. & BTW, I really appreciate your knowledge of unity/graphics/shaders/coding in general etc.. Such tuts about modern/relative topics & just brush ups are a gem for an old c cat who just dabbles a bit to keep up on things. 👍

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

    amazing that such content is for free :O

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

    I see Freya's video, i put thumbs up before i press "play"

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

    I would never have figured that reflection assignment out on my own, but after the explanation it makes sense....guess I have a lot of practice to do!

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

      yeah that was crazy assignment i still dont understand it after the explanation at all

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

    The colors that you choose are really appealing to the eye :)

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

    Perfect!!! What is going on with that math book you were talking about?

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

    You're brilliant!

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

    Thank you Freya you are the best teacher

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

    Thank you for your help 😊

  • @user-lb5yc6pr8x
    @user-lb5yc6pr8x 10 місяців тому

    I followed every step as you showed in the video and i'm very surprised by how this hack works! Thank You!

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

    freya you are the best. Thanks alot

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

    Dis is so good.

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

    Nice tutorial ! Can you talk about how we can use the trig functions to make primitive shapes like triangle, regular polygon and circle.. I’m sure others will like to know how cool trigonometry can accomplish this

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

      that's part of the assignments at the end of this! I talk about how to do it at the beginning of the next video :)

  • @nthnnnnnnnnn
    @nthnnnnnnnnn 2 роки тому +8

    (52:00) My preferred explanation for radians is:
    It's the length of the circumference of the angle (on unit circle).
    Which happens to be 6.28.. or 2π or Tau for full revolution.

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

      "It's the length of the circumference of the angle (on unit circle)."
      u meant:
      "The length of the *arc* substended by an angle on the unit circle" ?
      The word circunference is not a part of something, its a whole.
      Arc is a part (substended by a central angle of a circle) of the circunference.

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

      @@gutzimmumdo4910 You're right! That's what I meant. Thanks!

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

    Thank you Freya this is what i was looking for its "Determinant" I want to fire a rocket but I need to know how exactly I know if the rocket is facing enemy ship ......Thank you Best Game Dev Teacher for math.....I have to Finish the series the value of this Knowledge is Gigantic

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

    @2:01:55 I just wanted to mention that the range of arcsin (asin) is -1/4 turn to +1/4 turn, -90 to +90 degrees, -tau/4 to +tau/4 ( -pi/2 to +pi/2). That is in fact how atan2 can recognize the quadrant. If the vector is in the lower right corner, acos is positive and asin is negative. Similarly for the other quadrants, the signs of asin and acos are different so the correct quadrant can be determined. If asin had a range of 0 to 1/2 turn, then that would not be possible as the sign would always be positive, and thus not give the required additional clue for the quadrant.

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

    Recently watched and enjoyed the talk. At the 10:40 mark a reference to a document on How Meshes Work and how they are structured. Curious to know if that link is still available?

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

    we support you

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

    Really good

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

    Did you or could you make a video about quaternion math and how to use it in games ?

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

    I was looking fir something like this

  • @user-or3ho8xs1r
    @user-or3ho8xs1r Рік тому

    이것을 긴 시간동안 가르치는 당신은 대단합니다 ^^

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

    Hi o/ Where i can download sketches from the video? It will be helpful for my conspects of vector algebra. Thanks)

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

    I'm wondering if perhaps part of the reason Pi is more ubiquitous than Tau is because those inverse trig functions only really work unambiguously within the first two quadrants (eg: Where the angle is < Pi radians). I'm not saying that it's a good reason of course.

    • @King-mj2bn
      @King-mj2bn 2 роки тому +3

      I'd say it's simply a matter of habit. A long, long time ago it was much easier to measure the diameter of a circle than its radius. The concept of π is rooted in thousands of years of tradition and thus, by extension, is rooted in thousands of years of mathematical discoveries.

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

    Good day in your Trig class would tan be the equivalent of the Z value, basically how to extend to Vector3

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

    Nifty !

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

    what about the bonus challenge?:) Spent an entire night on "make an object move along the bounced path at a fixed speed when you press play" but can't get it to work properly... wonder if we can get some insight on that

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

    "atan" and "atan2" is the same, with "atan" u need to give one input which is the slope (y / x) and with "atan2" u don't need to divide yourself and just give y and x as an input (the "2" just stands for 2 inputs). I also thougth for a long time that "atan2" is something special^^

    • @King-mj2bn
      @King-mj2bn 2 роки тому +2

      You are incorrect, atan2 does more than just atan(y/x). It runs a check to determine if cos(α) is negative and adds pi to the result if it is. If you used simply atan(y/x) you'd have to assume that your coordinates DEFINITELY reside in quadrants I or IV. If they didn't, you'd end up with results you don't expect.

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

      @@King-mj2bn Doesn't it just check whether x is positive and negative? That's the only thing needed to check if it's in quadrants 2 or 3 instead of 1 or 4.. (1 being positive X and Y).
      float atan2( float y, float x ) => atan( y / x ) + 0 > x ? PI : 0;

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

    2:23:48
    how to show that arc line on game mode?

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

    Does the determinant thing work in 3D? I remember there is an equation for that in 3D. I actually have needed this in 3D to keep a physics object on a track using physics. If it's to the right of the path push it to the left to keep it on and so on.

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

      the determinant generalized to 3D is the wedge product, which is also similar in spirit to the cross product

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

    For the first problem:I made an overcomplicated solution where i got the "local space" basis vectors at the rayhit and did a bunch of dot products. Feling very dumb after seeing the easy solution.

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

    18:20
    The dot product between AB (b-a) and AC (c-a) wouldn't give you the height of the triangle?

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

    Good names for kids. "Come here Sin!" Go tell your brothers Cos and Tan they're grounded for confusing the masses."

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

    The reason so many things do not make sense to you is the world you confine yourself in. Well established or not, your world is what is flipped and twisted, you should appreciate that and deal with it instead of complaining. One would think you'd be a bit more openminded... But let's not argue, just take a look at this:
    The order is sine, cosine because the sine function is the base for the "co-sine" function. Of course this doesn't match your x, y order, but consider a world where 0° is 'up' and rotation taking place in a clockwise manner. In this world you'd find that sin(α) gives you the x-component and cos(α) the y-component. And guess what - atan2 takes x as the first argument in that world. Also, that's where I've lived for most of my life. Boy, was I confused when I first got into openGL, where everything was rotated on the side and then flipped on its face.
    I mean you should just adapt and appreciate that things are not the same for everyone, everywhere. Just because something doesn't fit well into your scheme of things doesn't mean it's wrong, right?

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

      Yes, it is a quirk. The math ist not stupid but perfectly fine, that's what I'm saying.
      It just doesn't fit so we'll in that world where axes are swapped. This is where the quirk lies, not in the order of function arguments.
      So what I meant is that she didn't seem to know, nor care that there's reason for those things. And by deal with it, I meant actually dealing with it; making it no longer be a problem, in whatever manner comfortable to her. Maybe my first comment seemed a bit harsher than it was meant to, so here's an apology for that.
      Just don't call a thing stupid, when you don't know why it is the way it is. It might not be stupid after all.

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

    I'm not a game dev by far. I've been trying to figure out how to code a simple plane ai for a game called From the Depths lol. Been trying to figure out how to get a plane to roll left or right depending on target bearing.

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

    Error. Tangent is cos to sin ratio if you doing algebra, and raycasting of angle vector to (Y-inf to +inf) line going though (X=1.0f). Illustrated in this video kinda tangent must have a hole between -1 and 1, but it continuous in that range.

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

    1:12:55 TAU = Math.PI*2f if not use anywhere else thats where it should be

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

    It seems your turret forward vector code is incorrect, just letting you know, i mean it works on flat surfaces but not slopes, by cross producting it with a sloped normal, it no longer points in the look direction of the camera (or whatever origin ray was used)

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

    57:29 tau is coming from pi not other way lol.

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

    What program is being used to illustrate?

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

    Trying to follow up by concentrating, but the cat's meowing i abstractive...Anyway, your explanations is great no matter what!

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

    4:20 If I was to do a quick cheap technique, I would just grab the vector, put the source at where it needs to hit the surface and multiple vector.y by -
    😂

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

    'My friend's name is Pi' 'Fuck that person' lollllll

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

    Hey Freya, I really like this series, extremely helpful and my mind has definitely been blown a couple of times, especially with the relationship between tau and the unit circle. This will help me a lot in the future, so many thanks from me :)
    The only criticism I have is that Thor's meowing can be distracting and annoying at some times. If you're doing more of these types of videos, I'd take that into account.
    Otherwise perfect video, keep them coming! :)

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

    YOU'RE FUCKING AWESOME and a huge inspiration to me!!

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

    They say there aren't any dumb questions, but surely there are questions that frustrate me and make me wonder if you were dropped as a baby.

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

    Late to the party, but maybe PI won because πr² for circle area is easier than ½TAU·r² ?

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

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

    Is there a video missing between part 2 and part 3?can any one help?

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

    We need a poster with: "Nothing is consistent, everything is garbage" - Freya Holmér

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

    The Furry God of Thunderous Meows requires sustenance.

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

    1:34 bruh sneezed on the cat

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

    "triangles - are they for you?" Geometers HATE this one simple TRICK!

  • @Sovereing2027
    @Sovereing2027 3 місяці тому

    1:12:20 How to make a square out of this at this point?

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

    I like Trig Too

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

    BIG fan of calling inconsistencies & aggravating things "garbage" myself, pronounced gabbage. 🤣

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

    Asgmt. 4 i didn't undertand how subract between ray and 2 * dotProduct(ray,n) * n give a mirror ray dir

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

    54:36 Or pI2 right Xd put second line for tau it become tau2 as pi but then full circle is pi2. not logic right lol

  • @UML649
    @UML649 2 роки тому +5

    Drawing straight line in photoshop: hold shift and just click any two positions on your canvas.

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

    1:18:23 makes sence radius is 1 LOL lets use dot so we can choose radius lol. i not want game with allways 2Meter circles xD

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

    amassava

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

    1:20:03 are you sure? is that normalized vector A allready hold x and y what you about to calculate lol

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

    1:53:38 Could you send me your math library?

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

      github.com/FreyaHolmer/Mathfs

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

    My reflection in a window: how many dimensions and con
    variables are there ?

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

    My school days have come to haunt me.

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

    Congrats on the apartment girls!

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

    Can't you just go y=dot(n, ray), and jump to yreflection=(-y), rather than multiplying by 2?

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

    I am a Mathematician and Philosopher; (I hate Mathematicians and Philosophers) All they do is {arg}ue about everything ! Alexander Grothendieck is insane because of everything you say and do, has so be a debate about semantics, context, and preconditions. {1}

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

    57:36 no its pi2 so you cant take 0.25*2 LOL pi is in midle

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

    I want to yeet that cat out the window

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

    I'm just going to leave a time mark where I stopped at 1:01:00

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

    1:13:23 still too same calculations

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

    Public education is criminal. This was infinitely easier to understand than going through the nonsense of math.
    Everything made sense until we started bluring the area between the contextual idea of length and distance.
    You'll get lost if you forget these are all VECTORS with a DIRECTION. In terms of algebra we don't really care.
    And I feel like the tangent segment started to slip into that area where vectors are not talked about.
    The animation does not make sense algebraically. Because you are asking why the tangent Shrinking is...well if you look at the tangent being a LINE it doesn't make sense but when you remember the tangent IS a vector...that is dependent on other vectors it makes sense.
    I was going to hop back in engine after 2 but I think I'm just going to keep watching for a bit more.

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

    Hi Freya. . . I nerd other oportunity. . Can You send me your Discord link?.

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

    Oh man, this woman codes so fast!
    I think she move a little bit slower so that we can learn from her.

  • @alexanderd.9954
    @alexanderd.9954 9 місяців тому

    no, i like pi xd

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

    she is gorgeous

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

    I like pies

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

    π is not good enough, long live τ !

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

    First

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

    NEVER apologise for having a sense of humor even when it might offend someone.
    You do not have the right to not be offended...
    -- The Bill of NO Rights --
    :)

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

    Why is this dude putting on that wierd voice.

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

      Nuh uh that's clearly a woman. But it's aight lil bro, I know for a fact you don't have much contact with women so you frequently mistake em.

    • @CC3GROUNDZERO
      @CC3GROUNDZERO 20 днів тому

      @@pipacombate393 Women are people with XX chromosomes. That biological man in the video is not a woman.