A 15 minute from Sebastian > a full semester of trig 270. Although this was 9 years too late for me, I know it will help someone else out there. Thanks for the upload as always!
Shouldn't theta be 60 degrees for the first problem when using sin for the angle within the 90 degrees triangle ? the 120 degrees you're using for theta is outside of the internal angle for the right angled triangle.
This has to be the most well-made and well-thought-out tutorial I`ve ever seen. I learned more from this 15 minute video, then 3 hours of work in school. And for that I thank you.
In all seriousness game dev is one of the easiest ways to learn complex maths. It's much easier to pick it up when you have an actual reason to use it.
Prototype Theta Yeah, it's really amazing. I wish it was possible to have lectures like this in school, would help me concentrate so much more. And the visuals really aid the understanding!
You have no idea how painfull this was to me, ahving the objects rotated in the wrong way and me just adding angles to make it face the right way and being frustrated by it. Now I know why and how it all actually works. Why everybody who makes "tutorials" on rotating your characters just say, oh here, copy pasta this code don't worry about it, when the explanation is so simple! Zero starts at X axis and goes anti cloack wise. SO SIMPLE!!! YET NOBODY EXPLAINS IT!!! I'm sooooooooooooo mad that the answer was so simple and yet I learn about it just now. Sebastian is the real unity MVP!!!
How to remember Sine cosine and tangent: SOH CAH TOA SOH: Sine is opposite over hypotenuse CAH: cosine is adjacent over hypotenuse TOA: tangent is opposite over adjacent
Thank you so much for this video. I just completed a computer science degree and I did not know before what is the meaning of a radian. Now I can understand what I have done so far.
A little late to the party, but wanted to point out something that I didn't see in the comments and I don't believe was mentioned in the video: there's a difference between the two ways of implementing the rotation ("90 - " method and swapping x and z). If you use the "90 - " method (the first one you showed), whenever we give no input, Atan2 is going to become zero (as it should, since the inputDir will just be a Vector3 filled with zeros). However, because we have that constant 90 degrees subtracting from Atan2 * Rad2Deg, the input angle becomes 90 degrees. This means that when we are not pressing anything, our character will face sideways, rotated about the y-axis by 90 degrees. This doesn't happen when we swap the z and x in the Atan2 function because the constant 90 degrees is not there anymore. In this case, when Atan2 goes to zero (whenever we give no input), the entire inputAngle variable becomes zero, as it should, meaning our character will face forward (+Z) with no input instead of sideways (+X) as it did in the "90 - " method. I think this explanation is right? Please correct me if I'm wrong.
This video video series is simply amazing, but this video in particular should help everyone understand what's going on in the movements. I was getting really confused about that because there are so many different ways of doing it, not to mention the rotation added on top. Thank you thank you thank you. And now I know trigonometry too ... I feel like I should go take a university trig course and get credit for it !!
Thanks for this great video. These 15 minutes explained a lot although c# programming, cos, sin and atan are new territories for me. Now i understand most of it and have a solution to my problems. Keep the work up
I swear it's like i asked you to do this just in time :) , Today i posted a question on unity form about this and now u uploaded, i think i'm able to do it on my own but i'll surely understand what im doing better after i watch this so thank you
Half a year ago, when I first met Unity, I succesfully "implemented" the Quaternion.LookAtRotation & Quaternion.Slerp functionalities. Just when I finished, I saw in a tutorial, that what I wrote in ~60 lines in days, there are these functions prewritten for you:D Good times.
Nice info tutorial, Sebastian, well done! I would just like to point something out, this angle conversion is not necessary(?) when we are working in 2D once the positive z-axis (which is the main axis for rotation in 2D) is pointing "opposite to the user". This can be seen when as we increase the rotation in the z-axis, the gameObject will rotate anti clockwise instead of clockwise (without any conversion)
And here I thought I would never use Trigonometry after I graduate.... 13 years later, I'm brushing up on Trig for my game development career. I've come full four quadrants.
Ha! After all my struggles with figuring out everything on my own. I learn a lot, on the way and how trig can be used. Oh well, I guess its not too bad learning this anyway.
I am wondering if you meant to keep 120 degrees as your reference angle? As I am on the toilet I cant check whether you actually used 60 degrees for your calculation and just forgot to update the graphic. I'm taking pre calculus and was wandering what real use trig has within programming. Now I know, very interesting video none the less, thanks for the time and effort. Cheers.
I can't see why he used an angle which is external to the right angled triangle, I think you're right, he should have used 60 degrees for the theta angle in the first example. 120 degrees has nothing to do with calculating the cos, sin or tan of that triangle.
Great work again, I wish you all the best for the future. I am aware you have had some contact with the good people at Unity, so maybe you know the reason why they didn't use the mathematical convention on this (and the standard forward direction for that matter). If you do, I'd love to know. That mini project looks cool, I might actually re-download Unity and review my C# to do it.
Are the tooltips about all the methods and parameters you use a monodevelop feature? How can I get those to show up in visual studio? It would help me learn so much 😅
Shouldn't theta be 60 degrees for the first problem when using sin for the angle within the 90 degrees triangle ? the 120 degrees you're using for theta is outside of the internal angle for the right angled triangle.
I know I'm super late to the party, but with trig, the triangle is for visualization. you care about the vector of r=1. so you take the angle from origin not in the triangle.
Can someone explain why it is used transform.Translate relative to the World space, I used relative to local space, and bugs on the movement have appeared. Awesome tutorial btw, well done Sebastian!
during about 9:20, you use Vector3 direction = new Vector3(Mathf.Cos(angleInDegress * Mathf.Deg2Rad), 0, Mathf.Sin(angleInDegress * Mathf.Deg2Rad)). I don't know why you use the Cos and Sin here, Can you please explain? thanks! 为什么这里的Vector3的x一定是Cos呢,为什么不能是Sin?
He is trying to find the direction his character should be facing based on the angle that is used. As he explained earlier in the video, you find the direction by taking the Sin and Cos of the angle, multiplied by the degree-to-radian conversion, and place that into your coordinates (x, y). (I know I'm answering this question 8 months after it was asked, but maybe someone will stumble upon this video later and have a similar question)
Ok so you never know, I'm posting here and hope someone reads this and can help me : I have litterally copied this code into my script. Everything behaves as it should except for one thing : when I dont have any key pressed, the rotation resets to zero. So when my "character" stops moving, it faces 0°, instead of facing the direction of its last movement. Can anyone help ? Besides, I love your series, this is a huge help ! Thank you.
So after mulling over my problem, I think i might understand how you would get the angle in the opposing unit circle to whichever unit circle you are currently working with (which conventionally is the trig unit circle?). Anyway, from how i understand it, if the trig unit circle is the default, and the angle is 0 degrees. Converting the angle to unity's unit circle goes as follows: 1) 90 - 0 = 90, 2) Taking note that the result is a positive value, you should then "increase" the angle from the naught angle in the unity unit circle (or whichever unit circle for whom you are converting the angle). 3) If the result were negative, e.g. if the angle to convert were 180, then 90 - 180 = -90, which means you should "decrease" the angle from the naught angle in the unit circle of interest, or rather, "increase" in the opposite direction to how angles are usually incremented in that unit circle. Which in the Unity unit circle, where angles increase clockwise, you’d find this angle by "increasing" in the anti-clockwise direction from naught. Just my way of understanding. I would appreciate it if anyone could clear up any errors within it. Thanks for reading this far. Cheers
Great videos as always, but I just want to ask why question. Why are you not using normal letters like A B C... instead of feta ? English is not my first language and I think a lot of people will think like feta is some kind of special thing(I thought the same when I first saw feta in your videos), but then they discover that it's just a letter. I'm pretty sure it confuses a lot of people.
Theta* The symbol represnets the angular position of a vector. Kind of like how X represents the the location along the "X-Axis" and Y represents the location on the "Y-axis". Yes technically you can substitute whatever symbols you want there. However then you have to explain what those symbols mean. By standardizing things like X, Y, Z and Theta you and everyone else immedietly understand what they represent. It confuses almost no one. Most people have already taken high school level math classes to know what theta is.
I didn't finish high school yet that's why I left this comment. I just learned the most basic things about trigonometry like sine, cosine and tangent(even though I already knew those. Anyway thanks for the correction
Hey, a bit of a late reply, but if you want to dig deeper into AI I suggest this book : Artificial Intelligence: a Modern Approach. It really covers any AI you might need in a video game and more
syr cxr tyx is much harder to remember than Soh Cah Toa I feel like you should've mentioned opposite/adjacent/hypotenuse notation for this reason Also the fact that unity's angles aren't the same as the standard trig angles has given me so many problems in the past, it's so annoying.
I was going crazy, thank you for highlighting that "Also the fact that unity's angles aren't the same as the standard trig angles has given me so many problems in the past, it's so annoying. "!
Hmm... It looks an awful lot like they mixed up cosine and sine when designing Unity, and never changed it to protect old code. And you cannot change my mind. Deal with it.
They also mixed the axes in my opinion, in other 3d programs that i've used the z angle is up but no, Unity chose to go for the y angle, you gotta get used to it
A 15 minute from Sebastian > a full semester of trig 270. Although this was 9 years too late for me, I know it will help someone else out there. Thanks for the upload as always!
Exactly my thoughts. Awesome.
Shouldn't theta be 60 degrees for the first problem when using sin for the angle within the 90 degrees triangle ? the 120 degrees you're using for theta is outside of the internal angle for the right angled triangle.
Dave Dogge I think so.
definitely helped 8th grade me.
This has to be the most well-made and well-thought-out tutorial I`ve ever seen. I learned more from this 15 minute video, then 3 hours of work in school. And for that I thank you.
In all seriousness game dev is one of the easiest ways to learn complex maths. It's much easier to pick it up when you have an actual reason to use it.
Prototype Theta Yeah, it's really amazing. I wish it was possible to have lectures like this in school, would help me concentrate so much more. And the visuals really aid the understanding!
Prototype Theta, I agree with you.
You have no idea how painfull this was to me, ahving the objects rotated in the wrong way and me just adding angles to make it face the right way and being frustrated by it. Now I know why and how it all actually works. Why everybody who makes "tutorials" on rotating your characters just say, oh here, copy pasta this code don't worry about it, when the explanation is so simple! Zero starts at X axis and goes anti cloack wise. SO SIMPLE!!! YET NOBODY EXPLAINS IT!!! I'm sooooooooooooo mad that the answer was so simple and yet I learn about it just now.
Sebastian is the real unity MVP!!!
How to remember Sine cosine and tangent:
SOH CAH TOA
SOH: Sine is opposite over hypotenuse
CAH: cosine is adjacent over hypotenuse
TOA: tangent is opposite over adjacent
We got taught it as Silly Old Hitler Coudnt Advance His Troops Over America
@@bobdagamer640 💀
In France we say CAH SOH TOA (casse-toi = get the hell out)
The production on these videos is off the charts. Amazing!
thank you for this! Finally someone succinctly explained why we use Atan2!!!
I don't need to watch a Sebastian's video till the end to give a Like. Before watching I've already given.
my my, the best explanation i ever had about trigonometry
Thank you so much for this video. I just completed a computer science degree and I did not know before what is the meaning of a radian. Now I can understand what I have done so far.
I literally don't understand how anyone could dislike these on purpose.
A little late to the party, but wanted to point out something that I didn't see in the comments and I don't believe was mentioned in the video: there's a difference between the two ways of implementing the rotation ("90 - " method and swapping x and z).
If you use the "90 - " method (the first one you showed), whenever we give no input, Atan2 is going to become zero (as it should, since the inputDir will just be a Vector3 filled with zeros). However, because we have that constant 90 degrees subtracting from Atan2 * Rad2Deg, the input angle becomes 90 degrees. This means that when we are not pressing anything, our character will face sideways, rotated about the y-axis by 90 degrees.
This doesn't happen when we swap the z and x in the Atan2 function because the constant 90 degrees is not there anymore. In this case, when Atan2 goes to zero (whenever we give no input), the entire inputAngle variable becomes zero, as it should, meaning our character will face forward (+Z) with no input instead of sideways (+X) as it did in the "90 - " method.
I think this explanation is right? Please correct me if I'm wrong.
yeah it worked for me, for some reason the player wouldn't rotate diagonally but this fixed it!
This video video series is simply amazing, but this video in particular should help everyone understand what's going on in the movements. I was getting really confused about that because there are so many different ways of doing it, not to mention the rotation added on top. Thank you thank you thank you. And now I know trigonometry too ... I feel like I should go take a university trig course and get credit for it !!
FANTASTIC TUTORIAL, please make more like this.
this guy is AWESOME math teacher ! i wish i had a teacher like u in the school.
Thanks for this great video. These 15 minutes explained a lot although c# programming, cos, sin and atan are new territories for me. Now i understand most of it and have a solution to my problems. Keep the work up
The explanation makes these so easy to understand, thank you!
I swear it's like i asked you to do this just in time :) , Today i posted a question on unity form about this and now u uploaded, i think i'm able to do it on my own but i'll surely understand what im doing better after i watch this so thank you
Nadim78Nadim NFA SAME HERE, BRO
me watching other trig videos: *visible confusion*
me watching this trig video: *visible happiness*
I want you as my teacher in college!
Great video! I really like how you teach difficult things in a simple way.
Damn amazing! This bloody thing in just 15 minutes but so well explained. Thank you so much!
Half a year ago, when I first met Unity, I succesfully "implemented" the Quaternion.LookAtRotation & Quaternion.Slerp functionalities. Just when I finished, I saw in a tutorial, that what I wrote in ~60 lines in days, there are these functions prewritten for you:D Good times.
Fantastic video! Keep up the great work.
Thanks a lot for this tutorial :) You are a amazing teacher !
best trigonometric explanation ever. :)
Any chance of a video explaining rotation matrices/quaternions?
I think he said he´ll be making a video on Quaternions soon.
@@novacti5254 *so that was a fucking lie*
Check the chanel of 3blue1brown, he has awesome videos explaining math stuff
@@novacti5254 its been 5 years
@@pitchblack5422 The dream lives on :')
Petition to make him college teacher. He explains better
YES
perfect timing, i need to rotare sprites to face their moving direction and this will solve all my issues
Nice info tutorial, Sebastian, well done! I would just like to point something out, this angle conversion is not necessary(?) when we are working in 2D once the positive z-axis (which is the main axis for rotation in 2D) is pointing "opposite to the user". This can be seen when as we increase the rotation in the z-axis, the gameObject will rotate anti clockwise instead of clockwise (without any conversion)
thank teacher for this video
Damn, this is understandable even for 8th-graders like me!
You are a fantastic teacher!
And here I thought I would never use Trigonometry after I graduate.... 13 years later, I'm brushing up on Trig for my game development career. I've come full four quadrants.
Crystal clear. Appreciated.
almost after 5 years of being professional game developer still watching this video for rotating god damn cube 😅
Ha! After all my struggles with figuring out everything on my own. I learn a lot, on the way and how trig can be used. Oh well, I guess its not too bad learning this anyway.
I am wondering if you meant to keep 120 degrees as your reference angle? As I am on the toilet I cant check whether you actually used 60 degrees for your calculation and just forgot to update the graphic. I'm taking pre calculus and was wandering what real use trig has within programming. Now I know, very interesting video none the less, thanks for the time and effort. Cheers.
I can't see why he used an angle which is external to the right angled triangle, I think you're right, he should have used 60 degrees for the theta angle in the first example. 120 degrees has nothing to do with calculating the cos, sin or tan of that triangle.
Great work again, I wish you all the best for the future. I am aware you have had some contact with the good people at Unity, so maybe you know the reason why they didn't use the mathematical convention on this (and the standard forward direction for that matter). If you do, I'd love to know.
That mini project looks cool, I might actually re-download Unity and review my C# to do it.
Thank you for making this.
Are the tooltips about all the methods and parameters you use a monodevelop feature? How can I get those to show up in visual studio? It would help me learn so much 😅
I have an advantge of asking my mom about maths since she is very smart at it🥳🥳
Shouldn't theta be 60 degrees for the first problem when using sin for the angle within the 90 degrees triangle ? the 120 degrees you're using for theta is outside of the internal angle for the right angled triangle.
I know I'm super late to the party, but with trig, the triangle is for visualization. you care about the vector of r=1. so you take the angle from origin not in the triangle.
Can someone explain why it is used transform.Translate relative to the World space, I used relative to local space, and bugs on the movement have appeared.
Awesome tutorial btw, well done Sebastian!
I feel, it will be very interesting day☺
"B-but when am I ever gonna use this in real life?"
during about 9:20, you use Vector3 direction = new Vector3(Mathf.Cos(angleInDegress * Mathf.Deg2Rad), 0, Mathf.Sin(angleInDegress * Mathf.Deg2Rad)). I don't know why you use the Cos and Sin here, Can you please explain? thanks!
为什么这里的Vector3的x一定是Cos呢,为什么不能是Sin?
He is trying to find the direction his character should be facing based on the angle that is used. As he explained earlier in the video, you find the direction by taking the Sin and Cos of the angle, multiplied by the degree-to-radian conversion, and place that into your coordinates (x, y).
(I know I'm answering this question 8 months after it was asked, but maybe someone will stumble upon this video later and have a similar question)
Sebastian could you make tutorial how to move empty object,with some velocity, along the circle with equations (cos(theta),sin(theta)) ?
Ok so you never know, I'm posting here and hope someone reads this and can help me : I have litterally copied this code into my script. Everything behaves as it should except for one thing : when I dont have any key pressed, the rotation resets to zero. So when my "character" stops moving, it faces 0°, instead of facing the direction of its last movement. Can anyone help ?
Besides, I love your series, this is a huge help ! Thank you.
Might be a little too late, but you can add an if statement to the area with the GetAngle variable.
Is there a reason to why some functions return a radian value while others return a degrees value?
Easier chart to learn greater than school 🌝
Wow, I understood all of it! Nonetheless, great video!
Please make a video about quaternions.
3:44 Wouldn't cos(0) = sin(90 + 0)?
Some quality content damn
Thank you so much for these amazing tutorials! :D Do you have any plans for Multiplayer/Networking?
Chupachu that would be cool!
Could you teach on how to make a sphere mesh based on this? I'm having problems converting 2D to 3D.
BEAUTIFUL !!!!
what software did you use to create the animations btw?
Unity
great as usual
Wow dude, your tutorials are premium stuff. But could you perhaps explain one tiny detail about how you do the conversions at 8:11 please?
So after mulling over my problem, I think i might understand how you would get the angle in the opposing unit circle to whichever unit circle you are currently working with (which conventionally is the trig unit circle?). Anyway, from how i understand it, if the trig unit circle is the default, and the angle is 0 degrees. Converting the angle to unity's unit circle goes as follows:
1) 90 - 0 = 90,
2) Taking note that the result is a positive value, you should then "increase" the angle from the naught angle in the unity unit circle (or whichever unit circle for whom you are converting the angle).
3) If the result were negative, e.g. if the angle to convert were 180, then
90 - 180 = -90,
which means you should "decrease" the angle from the naught angle in the unit circle of interest, or rather, "increase" in the opposite direction to how angles are usually incremented in that unit circle. Which in the Unity unit circle, where angles increase clockwise, you’d find this angle by "increasing" in the anti-clockwise direction from naught.
Just my way of understanding. I would appreciate it if anyone could clear up any errors within it.
Thanks for reading this far.
Cheers
More of these, please! :)
please trigonometric with IK for example climb system
other trig videos: *confusion*
this trig video: tan = blue line : green line
You're the best.
Thank you
You're fkin awesome dude!!!
8:27 "which you can maybe imagine as some sort of weapon"
yea right... weapon
Great ! 💯 Thanks
Great videos as always, but I just want to ask why question. Why are you not using normal letters like A B C... instead of feta ? English is not my first language and I think a lot of people will think like feta is some kind of special thing(I thought the same when I first saw feta in your videos), but then they discover that it's just a letter. I'm pretty sure it confuses a lot of people.
Theta* The symbol represnets the angular position of a vector. Kind of like how X represents the the location along the "X-Axis" and Y represents the location on the "Y-axis". Yes technically you can substitute whatever symbols you want there. However then you have to explain what those symbols mean. By standardizing things like X, Y, Z and Theta you and everyone else immedietly understand what they represent. It confuses almost no one. Most people have already taken high school level math classes to know what theta is.
I didn't finish high school yet that's why I left this comment. I just learned the most basic things about trigonometry like sine, cosine and tangent(even though I already knew those. Anyway thanks for the correction
yw
Could you make a series about AI? Especially about a goal orientated AI like GOAP. I can only find good tutorials about state machines.
Hey, a bit of a late reply, but if you want to dig deeper into AI I suggest this book : Artificial Intelligence: a Modern Approach. It really covers any AI you might need in a video game and more
I now know why we were taught trigonometry from class 8 hehe
syr cxr tyx is much harder to remember than Soh Cah Toa
I feel like you should've mentioned opposite/adjacent/hypotenuse notation for this reason
Also the fact that unity's angles aren't the same as the standard trig angles has given me so many problems in the past, it's so annoying.
I was going crazy, thank you for highlighting that "Also the fact that unity's angles aren't the same as the standard trig angles has given me so many problems in the past, it's so annoying.
"!
excelent, thx
how to do this for a 2d charcter top down
THANK YOU!!!!
very nice !
I'm just in 8th grade so this is super interesting
Deep!
finally that shit school math is worth now!!!
Nice
As some who studied a lot of high-level math, I find the unity coordinate system is very annoying
POP! Brain fart! I've got goo leaking from my ear!
Fuck you are so cool!
This is how to teach MAth
Hmm... It looks an awful lot like they mixed up cosine and sine when designing Unity, and never changed it to protect old code.
And you cannot change my mind. Deal with it.
They also mixed the axes in my opinion, in other 3d programs that i've used the z angle is up but no, Unity chose to go for the y angle, you gotta get used to it
but the theta for the coordinates should be 180-120=60
damn you make this too easy bro u should become a math teacher if it were good paying cough cough
tnx who dare to dislike :(((
o o f
Are You Secretly a Genius?
Am I the only guy who came here to learn math?
.... WAT
:P
I cringed so hard when he pronounced the name of the greek letter XD