I was pretty skeptical about a 4 minute sine function video. However you did a great job explaining the basics and still got straight to the practical usage! Good job ;-)
this video deserves SO MANY MORE VIEWS than it has current has! This is the most simple, elegant and easy to understand explanation of this concept I have seen ALL OVER TH-cam. And trust me I have looked at hundreds. The game title must be throwing it off on searchs. But millions of people in high school and college and needing to learn this concept. Maybe the video producer can post an alternative title to this video to help in searches.
A really good use for sine and cosine waves is with an orbiting camera around an object, even if it's moving. In your game loop, take the rotation transform on one axis of the camera and store it as radians in a variable. For example, if your object moves on the X-Z plane, store the rotation about the Y axis. Then find both the sine and cosine of the angle and store those in a variable. The new position of the camera can now be defined by adding these vectors: (Orbital Radius * Sine of the Angle, Y Position of Camera, Orbital Radius * Cosine of the Angle) + (X Position of Object, 0, Z Position of Object). You can find the orbital radius by figuring out the initial distance between the camera and the object. You can make the camera orbit by changing the Y axis rotation over time, either automatically or in response to some input.
Even Brackeys doesn't really understand Quaternions! Hell, even the ppl who invented them don't understand them and just made the functions Quaternion.Euler and the inverse function!
Thank you for the video. Next time please explain to us: - Quaternions; - Perlin noise; - Different sorting algorithms (I mean effective ones like QuickSort and HeapSort, not the Bubble); - Pathfinding algorithms (Dijkstra and other company of travelling sale agents).
Quaternions are difficult because they're part real numbers and part imaginary numbers (in the form w + xi + yj + zk, where w, x, y, z are real numbers and i,j,k are imaginary numbers). Interestingly, sine is related to the value of the imaginary numbers because the power functions of i,j or k will evaluate (using i as an example) to 1, i, -1, -i ... just like the rotation through the unit circle in this video. The difficult thing with explaining/understanding Quaternions is that they are fundamentally abstract and you can't really point to something and say "See, that's a quaternion in action" (but you can kinda point at everything and say it... such is abstraction). How they work (or how they can be understood to work in practice) depends entirely on what you're using them for.
Everything he says here is related to math, and not necessarily game development. You can find many tutorials about Quaternions if you don't wanna wait. They won't tell you how to use it in game development (or 3D art, in this case), but they will tell you about how Quaternions work, and then you can assume how to use them in whatever you want to know them for (there might be some tutorials that talk about them specifically for 3D stuff, I didn't check, but there are MANY that talk about them as a math topic).
Brackeys makes it easy to understand so I would like him to cover the topic in relation to the transform component or something like that. But I appreciate the comments. Also in a video about making a minecraft clone in unity within a week I saw how he used something that looked like it used a sin wave: Could somebody explain to me how you would use sin waves in world generation?
Blue Shadow Because when using Perlin Noise, it asks for a value between 0 and 10, where 10 is white and 0 is black (those are values which will be used later to generate the height, white is the most bumped and 0 the lowest). I am not actually sure why a sine wave, though, since it goes between -1 to 1. The best way is to perlin noise is using Lerp, not sine, so I am not sure... I am probably wrong and you saw sine in a different context. Can you send me the video where you saw it? I am probably wrong, but I don't want the things I wrote to go to waste, so I will keep them...I just want to give you a correct answer.
Also, except for tan and cosine, the coefficient of sine in a wave function will always produce some sort of exact outline, in x^2 you get plus or minus x^2 as the outline but in x^2+3x-4 the wave function pretty much follows the line, it’s super cool...
How would you use the sin wave to move an enemy? Would it work in a way that each foot would move based on the wave? So right foot would move at 1 and left at -1?
Important question. I was developing a microsoft visual studio in C# language. I had to make the obstacles fly in a sine wave function. Where the y coordinate was a sine function of time. Because the product is a long float. eg 3.1556778, the positions only work with integers. Else the motion would look buggy. Do you have a solution
Thanks for the video! If we want to have our object float up and down but from a starting point of say 3 on the y axis, how could we do this please? Sine always throws the object back to 0 as a starting point
question : if i have multiple object need to move like the coin, is it better to write a script use sin(t) on all these object, or simply create an animation for them? which 1 is better in term of performance?
If you really care about performance, or have a large amount of objects you could do one trick - create one script which calculates sin value each game frame and stores it into a public static variable. Then, on all objects just read variable value and apply it to the transform. Another, better approach - create some kind of animation manager (fancy name for a regular c# script :) ), store references to moving objects in it, each update calculate sin, and with simple for loop apply offset to the transform. This way you only do sin calculation once as opposed to n, where n is the number of objects. This, however, will make all the objects move sinchronously,and if you wish to de-sinchronize movement you'll still need to calculate sin per object with different time offsets.
Thanks for the tips, the explanation was pretty clear, but i'm still curious if a script or an animation would be better, there might be the case all object need to be animate independently.
I have one word for you my friend "AWSOME" if you could make something on quaternions , physics simulation of vehicles like wheel colliders that would be of great help thanks any was great video
can u please create a tutorial on... Like when the player in the game is inactive for a certain period... The next next process is highlighted(for example the finish point is highlighted) so that the player knows where he has to go..
I registered on the brakeys forum but when I want to create thread it says i eed to confirm my account :( but I got no confirmation email only 1 at the start but it was empty my name is Sh4d0w and I have the same profile pic
Hey! Loved the video! I have a question. How Would I make waves one a 2D water thing, and A wave like splash at the point of impact when a rigid body hits it? Thanks, Some Guy You Don't Know That's subbed too you.
holy wow, years of school and I finally understood the sine function in a 4:20 min video.
So you just didn't pay attention in school then?
@@squeakybunny2776 schools are like drugs made to cure all diseases in one pill.
Was it your " high"-school?
Like brackeys said. I need to get out more...
For real though
@@squeakybunny2776 yeah I can't believe it when I see comments like this, did your teacher suck that badly?
"thats just a theory, a game math theory" dam that got me laughing XD
small world
well hello, small world it is..
Look! It's Matt Murdoc!!!
same haha
Saaaaaaaaame!
I instantly thought of Game Theorists as you said "Hey, thats just a theory" and i grinned as you really did this joke ^^
I was pretty skeptical about a 4 minute sine function video. However you did a great job explaining the basics and still got straight to the practical usage! Good job ;-)
It would be super interesting to have a video about Quaternions. Keep the great work going :)
yes, quaternions!
this video deserves SO MANY MORE VIEWS than it has current has! This is the most simple, elegant and easy to understand explanation of this concept I have seen ALL OVER TH-cam. And trust me I have looked at hundreds. The game title must be throwing it off on searchs. But millions of people in high school and college and needing to learn this concept. Maybe the video producer can post an alternative title to this video to help in searches.
A really good use for sine and cosine waves is with an orbiting camera around an object, even if it's moving. In your game loop, take the rotation transform on one axis of the camera and store it as radians in a variable. For example, if your object moves on the X-Z plane, store the rotation about the Y axis. Then find both the sine and cosine of the angle and store those in a variable. The new position of the camera can now be defined by adding these vectors: (Orbital Radius * Sine of the Angle, Y Position of Camera, Orbital Radius * Cosine of the Angle) + (X Position of Object, 0, Z Position of Object).
You can find the orbital radius by figuring out the initial distance between the camera and the object. You can make the camera orbit by changing the Y axis rotation over time, either automatically or in response to some input.
I would love a video about how you manipulated that plane mesh to create a wave.
Have a look at the standard water assets in Unity! :)
That's just a simple shader I assume
th-cam.com/video/3MoHJtBnn2U/w-d-xo.html
I did this video last year, it was neat to do it all through code :3
Probably used perlin noise
I'm thinking of that procedural mesh generation thingy he made a video for but plug a sine wave in the y instead of just noise
Nice ^^ i would love to see one of these about Quaternions :D
Even Brackeys doesn't really understand Quaternions!
Hell, even the ppl who invented them don't understand them and just made the functions Quaternion.Euler and the inverse function!
Like... the people who invented them were like... 'It works.. but why?.. NO! DON'T TOUCH IT, LEAVE IT AS IT IS!!'
Swyse Official We are just inferior beings that will never truly understand Euler's advanced concepts.
Brackeys left the chat
@@HAWXLEADER The Inventor of the quaternions was so happy about his discovery that he carved it into a bridge. (Broom Bridge)
Can you PLEASE continue this series? It is so well explained and I'm sure it will immensely help any aspiring gamedev
dude you're so gosh darn good at teaching, it's insane! TY TY TY
How can I possibly thank you enough, I just so wanna hug you right now!!!
ok during Highschool I had trouble understanding Sin curves (Cos and Tan Ones aswell) your video just made it Click thanks so much.
this series is awsome keep it up
OMG WHAT IS THAT FOR GREAT QUALITY?!?!?! You deserve 1.000.000 subs or more!
Very informative and fun series to watch, giving examples on how to apply maths learned in high school for example to your games. Keep it up!
BRO !! u are so perfect when u come to explain math !!
Ha! I loved the bonus fact about the beep sound! Well done!
Thank you for the video.
Next time please explain to us:
- Quaternions;
- Perlin noise;
- Different sorting algorithms (I mean effective ones like QuickSort and HeapSort, not the Bubble);
- Pathfinding algorithms (Dijkstra and other company of travelling sale agents).
You actually explained it way better than my physics teacher did back in the day. (For those that wonder: yes, I really ment physics teacher)
u saved my life. Thank you.
Awesome video!
Nothing new that I didn't know but still a very nice, informative and quality made video.
you're godsent, I finally understood it!! 😭🖤
PLEASE! BY GOD EXPLAIN QUATERNIONS! even my Math teacher doesen't know anything about them
Quaternions are difficult because they're part real numbers and part imaginary numbers (in the form w + xi + yj + zk, where w, x, y, z are real numbers and i,j,k are imaginary numbers). Interestingly, sine is related to the value of the imaginary numbers because the power functions of i,j or k will evaluate (using i as an example) to 1, i, -1, -i ... just like the rotation through the unit circle in this video. The difficult thing with explaining/understanding Quaternions is that they are fundamentally abstract and you can't really point to something and say "See, that's a quaternion in action" (but you can kinda point at everything and say it... such is abstraction). How they work (or how they can be understood to work in practice) depends entirely on what you're using them for.
Everything he says here is related to math, and not necessarily game development. You can find many tutorials about Quaternions if you don't wanna wait. They won't tell you how to use it in game development (or 3D art, in this case), but they will tell you about how Quaternions work, and then you can assume how to use them in whatever you want to know them for (there might be some tutorials that talk about them specifically for 3D stuff, I didn't check, but there are MANY that talk about them as a math topic).
Brackeys makes it easy to understand so I would like him to cover the topic in relation to the transform component or something like that. But I appreciate the comments. Also in a video about making a minecraft clone in unity within a week I saw how he used something that looked like it used a sin wave: Could somebody explain to me how you would use sin waves in world generation?
Blue Shadow Because when using Perlin Noise, it asks for a value between 0 and 10, where 10 is white and 0 is black (those are values which will be used later to generate the height, white is the most bumped and 0 the lowest). I am not actually sure why a sine wave, though, since it goes between -1 to 1. The best way is to perlin noise is using Lerp, not sine, so I am not sure... I am probably wrong and you saw sine in a different context. Can you send me the video where you saw it? I am probably wrong, but I don't want the things I wrote to go to waste, so I will keep them...I just want to give you a correct answer.
on second thought it may not have been sin at all
"that's just a theory!" that alone made me sub
This helped so much you’re actually the best
I finally understand Sine. Thanks for all the awesome, and informative, videos~
Really useful to show to students - thank you, Arun.
Also, except for tan and cosine, the coefficient of sine in a wave function will always produce some sort of exact outline, in x^2 you get plus or minus x^2 as the outline but in x^2+3x-4 the wave function pretty much follows the line, it’s super cool...
So much I can do with such a simple function. Thanks for the video!
I took Trig and never understood where they got the x's and y's of the sin cos and tan functions. Now after one video I finally get it.
this part 2:04 saved my life now i compeletley know what is it
Wow this was awesome. I wish you were my calculus teacher in varsity. Things would've been a lot more interesting. Keep up the great work.
1:22 "THE UNIT CIRCLE!! I need to get out more..."
Amazed that his most useful videos have less likes than other not so important vids
Quick to the point and well done. Thank you!
Best Explanation Sir 👍👍👍
How would you use the sin wave to move an enemy? Would it work in a way that each foot would move based on the wave? So right foot would move at 1 and left at -1?
3:30 laughing and spilling my coffee out on the table
ha
Underrated channel
Nice game theory refrence
Great video, we need move math theory videos!
I have viewed these as shapes which I can use to permute other shapes for a long time now.
This function is awesome, thanks a lot!
Awesome, thanks! I never knew how time manipulation was done in video games.
Important question. I was developing a microsoft visual studio in C# language. I had to make the obstacles fly in a sine wave function. Where the y coordinate was a sine function of time. Because the product is a long float. eg 3.1556778, the positions only work with integers. Else the motion would look buggy. Do you have a solution
Thanks for the video! If we want to have our object float up and down but from a starting point of say 3 on the y axis, how could we do this please? Sine always throws the object back to 0 as a starting point
I liked the way u pronounce Arun Mehta
I actually love these. Can you cover quaternions next?
matpat in the corner thinking about making math theory
Funny, I learnt it in my Russian school when I was 13, but Brakeys explained sin more interesting than in my school.
question : if i have multiple object need to move like the coin, is it better to write a script use sin(t) on all these object, or simply create an animation for them? which 1 is better in term of performance?
If you really care about performance, or have a large amount of objects you could do one trick - create one script which calculates sin value each game frame and stores it into a public static variable. Then, on all objects just read variable value and apply it to the transform. Another, better approach - create some kind of animation manager (fancy name for a regular c# script :) ), store references to moving objects in it, each update calculate sin, and with simple for loop apply offset to the transform. This way you only do sin calculation once as opposed to n, where n is the number of objects. This, however, will make all the objects move sinchronously,and if you wish to de-sinchronize movement you'll still need to calculate sin per object with different time offsets.
Sorry BTW for my English, I hope I haven't confused you :)
Thanks for the tips, the explanation was pretty clear, but i'm still curious if a script or an animation would be better, there might be the case all object need to be animate independently.
Love this series. It really deserves more views. Still would love to see an episode on dot product.
Wow I learned something new Thanks
Great video, really well made.
Can sine functions oscillate between desired outputs or it is fixed between -1 and 1?
I like the editing!
smol brackeys: "that just a theory, a game math theory"
big brackeys: Leaves us 😭😭
lol I'm 12 so now I get to be ahead of my maths class by a couple of months
nope. by a couple years. been there still there
NoobStudios, why so negative?
I'm not being negative. Did you even read my comment?
NoobStudios Atleast he's being positive over something and you come with your negative attitude towards his comment.
Why do realise i was not being negative? I was saying he was ahead of his class by years instead of months...
Awesome explanation
Im in class and the game theory joke almost made me laugh out loud 😂😂
learning game development and pre-calculus
is there anyway to use sine waves to make certain level. patterns like sky force (a space shooter game)?
Me after seeing Geogebra: "Yeaaah Baby! Thats exactly what I've been waiting for.
It is possible to create a Sinus rhythm (Heart beat) with sine waves in Unity?
you are my hero, keep it up!
Very Good Video beside Game Development
miss u brackeysssss
Off topic question:
Can you try to recreate the iOS game Impossible Road, in unity?
I wish you'd do more of this series! Why'd you stop?
what software are you using? looks amazing for learning
So many possibilities from just sin(t)!!! You could make repeating animation and stuff.
3:33 LOL!! Quaternion pelease!!!
Feeling enlightened thank you Master hehehe
Whats the name if the program used to draw the sine waves??
Instant subscribe.
I have one word for you my friend "AWSOME" if you could make something on quaternions , physics simulation of vehicles like wheel colliders that would be of great help thanks any was great video
1:45 what the name of that program?
I looked around for a bit and I THINK the program is called SageMath
TRIBAR in fact its geogebra
Thanks! Was wondering the same thing.
Geogebra
It's just a theory A GAME MATH THEORY
The Theorists: HECK YEAH!
what software is it at 1:46 ?
Hey would you please mind to tell me what software you are using to create those animations?`
Very much appreciated!
you are a legend thank you so much!!!!!
Brilliant! Thanks
can u please create a tutorial on... Like when the player in the game is inactive for a certain period... The next next process is highlighted(for example the finish point is highlighted) so that the player knows where he has to go..
What software did you use to simulate the rotation on unit circle?
Thanks mate..Ill look into it..
how do you do a sine function in unity though
private Vector3 _startPosition;
void Start ()
{
_startPosition = transform.position;
}
void Update()
{
transform.position = _startPosition + new Vector3(Mathf.Sin(Time.time), 0.0f, 0.0f);
}
You are amazing, really :o
But hey, that's just a theory. A GAME MATH THEORY. Thanks for watching.
Beutiful=D sir I really appreciate you hahahha
finaly I've understood HOW sin/cos func works. It's n*(X) where n = for(n=-3.14/n=0; n
Thank you
how did they create the function "sin (angle)" ?? I know I only need to use "Math.sin (f)", but I want to know how they created this function.
I miss this guy😢
what app did you use to showcase the sin wave?
It is called Geogebra
thanks
Yeah! so i can turn my homework to my teacher with unity project hahaha
Thanks👍
MatPat wannabe... lol keep up the good work man! I actually kinda enjoyed the GameTheory reference and I can see this series going places.
just amazing
I registered on the brakeys forum but when I want to create thread it says i eed to confirm my account :( but I got no confirmation email only 1 at the start but it was empty my name is Sh4d0w and I have the same profile pic
Hey! Loved the video! I have a question. How Would I make waves one a 2D water thing, and A wave like splash at the point of impact when a rigid body hits it? Thanks, Some Guy You Don't Know That's subbed too you.
will you do cosine and tangent
A cosine graph is almost exactly the same as a sine graph and i cant imagine any use for a tan graph since its range is -infinity to +infinity
Some Random Noob still i wanna knoow about them
then grab a math book
I AM LITERALLY TRIGGERED