Game dev
Saved & recent

Trigonometry

Related terms: sine, cosine, tangent, radians

The relationship between angles and lengths. On a unit circle, an angle θ measured from the positive X axis gives the point (cos(θ), sin(θ)). Cosine gives X; sine gives Y.

Multiply both by a radius to orbit a pickup or place enemies around a ring. Sine also makes repeating motion, such as bobbing. This diagram uses Y pointing up; screen coordinates may point down.

point = center + radius * (cos(t), sin(t))

Further reading
Khan Academy: Unit circle trigonometry
X Y π/3 unit circle 0 π 2π -1 0 1 angle (radians) component cos θ sin θ
The angle π/3 picks a point on the unit circle. Its horizontal and vertical coordinates are the marked values of cosine and sine.

View in the full Game dev collection