Trigonometry in Game Development

  Рет қаралды 55,665

DaFluffyPotato

DaFluffyPotato

4 жыл бұрын

Trigonometry is pretty important for anything in game development that uses angles. I made this video to cover a couple very common uses of trigonometric functions.
Discord:
/ discord
Twitter:
/ dafluffypotato
#gamedevelopment

Пікірлер: 77
@atibyte
@atibyte 4 жыл бұрын
Watching videos about game dev and math is always interesting.
@jhonnatanwalyston6645
@jhonnatanwalyston6645 4 жыл бұрын
it's a cool way of procrastinating
@sid98geek
@sid98geek 3 жыл бұрын
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!
@HarishKumar-0405
@HarishKumar-0405 3 жыл бұрын
@@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 жыл бұрын
@@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 жыл бұрын
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 жыл бұрын
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 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 5 ай бұрын
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!!
@eleos5
@eleos5 2 жыл бұрын
Well paced, visually pleasing, good examples, good video!
@Kilogya
@Kilogya 2 жыл бұрын
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.
@jarnoderyck2212
@jarnoderyck2212 3 жыл бұрын
dude, I love this video, great, great work
@hm4266
@hm4266 4 жыл бұрын
Super useful!
@Byynx
@Byynx Жыл бұрын
Great video !!!😊 Very clever.
@qzorn4440
@qzorn4440 6 ай бұрын
Great trig information. 😎 Thanks.
@DiceDrivenGameDev
@DiceDrivenGameDev 4 ай бұрын
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
@Raphy084
@Raphy084 4 жыл бұрын
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
@zackydev
@zackydev 3 жыл бұрын
lol same
@soupnoodles
@soupnoodles 3 жыл бұрын
bruh same
@Plasterdeath1848
@Plasterdeath1848 4 жыл бұрын
yoo, thank you for this video, can you please make videos on particle effects as well as adding pixelated/drawn backgrounds
@dafluffypotatovr7362
@dafluffypotatovr7362 4 жыл бұрын
I'll probably do the particles at some point, but backgrounds are just blitting an image before everything else.
@8-bitsteve500
@8-bitsteve500 3 жыл бұрын
Well.. I got to 53 seconds in before I was utterly lost. hah
@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.
@astrangepotato7120
@astrangepotato7120 4 жыл бұрын
First! i absolutely love ur vids theyre so useful could you please make a vid about basics of pixel art?
@dafluffypotatovr7362
@dafluffypotatovr7362 4 жыл бұрын
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 Жыл бұрын
I use this for a circle but I was stuck in trajectory calculations so ..... A huge tanks to you
@Mupersega
@Mupersega 3 жыл бұрын
Thank you, many times.
@zackydev
@zackydev 4 жыл бұрын
Nice vid
@zerokun2655
@zerokun2655 3 жыл бұрын
man i study trigonometry at school and know the concepts in the video i feel smart :)
@pranitp.1622
@pranitp.1622 2 жыл бұрын
lol this is just some basic trigonometry advanced level trigono stuff is much harder
@doclouis4236
@doclouis4236 Жыл бұрын
@@pranitp.1622 So advanced trig and calculus are required in order to be a good game programmer, right?
@Haolfy
@Haolfy Жыл бұрын
​@@doclouis4236 depends on the type of game or program you're making.
@doclouis4236
@doclouis4236 Жыл бұрын
@@Haolfy - Action RPG - Platformer - 3D Beat Em Up Which one of these?
@Haolfy
@Haolfy Жыл бұрын
@Doc Louis TLDR: Yes, you will need calculus and trigonometry to be a good game developer. But many programming languages have built-in functions & libraries. The computer will do the majority of the math. Trigonometry in the real world is "used in geography to measure the distance between landmarks." Similarly, it is used for the same reasons in game development. Games like GTA 5 used trigonometry to make their environments more realistic. Trigonometry isn't a necessity for platformers but with 3d beat em ups, & especially action rpg's. Essential math for game development includes but is not limited to: Linearalgebra,Trigonometry,Calculus,probability,logic/discrete mathematics.
@slamsandwich19
@slamsandwich19 2 жыл бұрын
what did you use to make this video btw just curious
@DaFluffyPotato
@DaFluffyPotato 2 жыл бұрын
Probably Krita
@RasamRohit
@RasamRohit 5 ай бұрын
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 21 күн бұрын
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
@kevinw5539
@kevinw5539 4 жыл бұрын
what is your favourite palette on aseprite? thank you.
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
I make most of my palettes.
@zackydev
@zackydev 4 жыл бұрын
@@DaFluffyPotato the professionalist Lol
@basicallybrand
@basicallybrand 2 жыл бұрын
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 жыл бұрын
Learn trigonometry first.. you can learn it from KZfaq
@cjdlegendary1795
@cjdlegendary1795 3 ай бұрын
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 3 ай бұрын
A flipped Y means you need to make either your angle or your sine output negative to correct it.
@cjdlegendary1795
@cjdlegendary1795 3 ай бұрын
@@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
@kheosz2455
@kheosz2455 2 жыл бұрын
I like to do game development. But I'm always afraid with trigonometry shit cuz im very bad at math
@magnuswootton6181
@magnuswootton6181 2 жыл бұрын
its cool getting rid of the sqrt, but people will delete your code if you put it on the internet unfortunately.
@banishedguardian701
@banishedguardian701 3 жыл бұрын
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 жыл бұрын
how to make the object facing mouse pleaaaaaaaaaaaaaase
@xerneastrainer8111
@xerneastrainer8111 2 жыл бұрын
Use if statements and flip the image.
@gamingghost7335
@gamingghost7335 2 жыл бұрын
@@xerneastrainer8111 hhh 360 if statements to flip img
@xerneastrainer8111
@xerneastrainer8111 2 жыл бұрын
@@gamingghost7335 Or a switch-case.
@dimitrijekuzmanovic5792
@dimitrijekuzmanovic5792 4 жыл бұрын
Hello there
@zackydev
@zackydev 3 жыл бұрын
General Kenobi
@olivercharles2930
@olivercharles2930 Жыл бұрын
i am way too stupid to get trigonometry
@Fullrusher
@Fullrusher 3 жыл бұрын
Discouraging :-/
@DevHedron
@DevHedron 3 жыл бұрын
what, how?
@Fullrusher
@Fullrusher 3 жыл бұрын
@@DevHedron 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
@DevHedron
@DevHedron 3 жыл бұрын
@@Fullrusher what is so hard for you in this, if you face problems you can come into the discord server.
@phoenixehc
@phoenixehc Жыл бұрын
@@Fullrusher What helped me was to write it all down in simple steps 1 by 1. Jotting down all the key words with definitions
@Raja-iq5pn
@Raja-iq5pn 3 жыл бұрын
size doesn't matter
@Inevitably_forget
@Inevitably_forget Жыл бұрын
Don't mind me, just looking for a reason not to say "Fuck math"
@vedanshyadav-ye8bx
@vedanshyadav-ye8bx 2 ай бұрын
Please make video in hindi😊
Trigonometry Concepts - Don't Memorize! Visualize!
32:35
Dennis Davis
Рет қаралды 2,7 МЛН
бесит старшая сестра!? #роблокс #анимация #мем
00:58
КРУТОЙ ПАПА на
Рет қаралды 2,9 МЛН
Must-have gadget for every toilet! 🤩 #gadget
00:27
GiGaZoom
Рет қаралды 11 МЛН
Trigonometry - Easy to understand 3D animation
16:29
Physics Videos by Eugene Khutoryansky
Рет қаралды 1,1 МЛН
The Folded Polynomial - N64 Optimization
14:26
Kaze Emanuar
Рет қаралды 228 М.
A Programmer's Guide to Pixel Art
9:28
DaFluffyPotato
Рет қаралды 174 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 686 М.
How to ACTUALLY get into Gamedev
14:01
DaFluffyPotato
Рет қаралды 689 М.
I made Games with Python for 10 Years...
28:52
DaFluffyPotato
Рет қаралды 263 М.
One Month of Game Development | Dream Game Devlog 1
9:31
Caleb Gilbert
Рет қаралды 72 М.
Giving Personality to Procedural Animations using Math
15:30
t3ssel8r
Рет қаралды 2,4 МЛН
Trigonometry | Gamedev Math
13:21
Natsu Games
Рет қаралды 22 М.
Нашел еще 70+ нововведений в iOS 18!
11:04
Секретный смартфон Apple без камеры для работы на АЭС
0:22
Ждёшь обновление IOS 18? #ios #ios18 #айоэс #apple #iphone #айфон
0:57
Какой ПК нужен для Escape From Tarkov?
0:48
CompShop Shorts
Рет қаралды 270 М.