Skip to content

Instantly share code, notes, and snippets.

View helloworldsmart's full-sized avatar
😀
I may be slow to respond.

MichaelChen helloworldsmart

😀
I may be slow to respond.
  • Mars
View GitHub Profile
@jhonnymichel
jhonnymichel / gamedev-trigonometry.md
Last active January 27, 2026 06:24
Basic trigonometry for game development

Introduction

two distinct points (for example, a game object position and the mouse cursor position) in an area can always be two corners of a Right Triangle (Triângulo-retângulo in ptbr). A triangle has three sides: The Hypotenuse, the Adjacent and the Opposite.

The distance between two points in the X axis corresponds to the Adjacent side of a triangle, The distance between two points in the Y axis corresponds to the Opposite side of a triangle.

The Hypotenuse is the shortest distance between the two points.

This means we can use trigonometry to handle many interactions between objects when programming visual stuff.