Forget the SOH-CAH-TOA trauma. Nobody in gamedev is solving triangles. sin and cos are just the coordinates of a point going around a circle — and once you see that, orbits, bobbing fish, water, swim paths and screen shake are all the same two lines of code.
press play — 90 seconds ↓Plays like the video — one caption at a time, the picture animating under it — and it pauses when it's your turn. Skip around with the dots or arrow keys. The full lab comes after.
Take a circle of radius r. Put a point on the rim at angle
θ. Where is it? X = r·cos(θ), Y = r·sin(θ). That's the entire
definition — cos answers "how far across?", sin answers "how far up?".
Drag the point around the rim (or hit spin) and watch the two legs trade lengths.
Now the classic reveal. Keep the point spinning, but plot its height
over time off to the right. The circle unrolls into the sine wave — that wobbly
curve isn't a new thing to memorize, it's the same point, viewed sideways. Tick the
cos box: same wave, just starting a quarter-turn (90°) earlier.
Here's the gamedev payoff. Feed time in as the angle —
θ = t·speed — and the spinning point becomes an orbit. Use only the sin half
and it becomes a bob. Use two sins with different frequencies and you get the fish swim
paths from the video. Every tab below is the same two lines wearing a different costume.
cos θ, −sin θ, sin θ, cos θ? It's this chapter in a coat — rotating a point
is just moving it around the circle.sin(t·40) × amplitude at high frequency,
with the amplitude decaying over time. Chapter 09 will smooth the decay — but the
wobble itself is pure sin.(r·cos θ, r·sin θ) with θ climbing forever. Placing icons around a circular
minimap? Same formula, one point per enemy.sin(timeOfDay). Ambient
light, sky color, shadow length — all driven by one slow sine that loops forever
for free.Game water before fancy shaders existed — and still the backbone of stylized seas: every vertex of this mesh runs y = A·sin(x·k + t) + ½A·cos(z·k′ + t) each frame. The buoy just reads the same function at its own (x, z). The moon runs chapter-standard cos/sin orbit.
Click any moment on the right — it takes you straight there (in place when this site is served over http, on YouTube when opened as a local file).