Trigonometry in Game Development

preview_player
Показать описание
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:

Twitter:

#gamedevelopment
Рекомендации по теме
Комментарии
Автор

Watching videos about game dev and math is always interesting.

atibyte
Автор

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!!

IceForgeOfficial
Автор

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?

mouseclicker
Автор

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.

Kilogya
Автор

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

Raphy
Автор

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

DiceDrivenGameDev
Автор

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

eleos
Автор

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

cauchy_math
Автор

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

zerokun
Автор

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

watchingwolf
Автор

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.

unknownuser
Автор

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

-bitsteve
Автор

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

Plasterdeath
Автор

dude, I love this video, great, great work

jarnoderyck
Автор

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.

cjdlegendary
Автор

So you have used
x += cos(direction) * speed
y -= sin(direction) * speed

But isn't this also the formula for circular motion
x =
y =


Can anyone explain how are they the same??

RasamRohit
Автор

what is your favourite palette on aseprite? thank you.

kevinw
Автор

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

kheosz
Автор

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

basicallybrand
Автор

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

magnuswootton