Learn trigonometry for game programming using SpriteKit and Swift. You will learn the theory and then practice using trigonometry by making a space shooter game!

@cinnastix Most likely that you aren’t using a component that changes as time passes. If you look at the updateOrbiter method in the tutorial, you’ll notice it take a parameter that increases as time passes. That value is used in the calculation to change the angle over time. Without this value changing, the object would remain in one spot.

This is great. Except, when I go the interactive circle link, it throws everything I learned off. Putting it at a 45 degree angle, it displays the cosine as the Blue line, and the sine as the green line. From what I thought after looking at the part 1 photos, when you use cosine, it returns the value of the opposite side. And as for sine, it returns the value of the adjacent side.

So which is right? Is the cosine the value of the blue line as it is in the interactive link, or is it the value of the opposite line like the photos say here?

Of course, when you Google you get the formula cos() = adj / hypotenuse

For the figure with the sin, cos, and tan defined, the graphic is showing the two sides being used in orange, and the remaining unused side in blue.

sin(angle) = opposite / hypotenuse (opposite side and hypotenuse are orange)
cos(angle) = adjacent / hypotenuse (adjacent side and hypotenuse are orange)
tan(angle) = opposite / adjacent (opposite side and adjacent side are orange)

The graphic is a bit unusual; usually the hypotenuse is not emphasized like that. It is the case, though, that cos goes with adjacent, or the blue line in the interactive circle. You can also think of it as cos gives the X value, and sin gives the Y value, as long as the triangle is in the standard position.