If you didn’t read part 1, and want to get background on sine waves for game development. Click Here (PART 1).
If you did read it, or don’t care, please continue.
Last time it was all about the basic sine function and how to make game objects move in the shape of a sine wave. This time let’s take it a step further. I’m going to show you a few more practical applications of sine waves, that isn’t limited to just moving objects.
I think I used the word oscillate more than 6 times in the last post, but it’s the essence of sine waves. This post isn’t going to be too long, since I think you’ll catch on quick if you haven’t already. Basically what I’m telling you, is that if you want anything to smoothly move back and forth (oscillate) between two states, values, locations, etc, USE THE SINE FUNCTION.
Don’t worry, this isn’t going to be a whole Trig class. I will however, go over one very useful trigonometric function that is easily overlooked by beginner, and even veteran game developers. The Sine Wave. Hopefully this will fuel your own curiosity to learn more about trigonometry and how applicable it is to the world of game development.
If you know what the Sine function is, fantastic, if not, I’m sure you’ve heard the term. You may have encountered it in high school geometry or trigonometry, and it’s applied in just about every field that involves some kind of math.
Sine waves are a graph of the Sine function, and given a basic form, as the input value changes, the output will oscillate between 1 and -1. Here’s what that looks like:
Note: You may notice that the sine wave perfectly maps to a circle of radius 1. That form of circle is called a Unit Circle. Understanding it is helpful but not necessary. As I said this is not a trig class. Moving on.