Hexagons in pixel art

You should probably either find a template someone has made or use a measurement tool to help with placement if your program has one. The full explanation is a bit mathy. First, a "perfect" (regular) hexagon has equally sized sides and angles, so for a given side length, you want the diagonal lines to match that and your angles to all be 120 degrees.

If your canvas is just big enough to fit a regular hexagon, it should be a square, which also helps us: we only need to find the size of one side of the canvas for a given edge size of the hexagon.

To help, here's a figure of some triangles you can draw on a regular hexagon, regardless of size: https://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Regular_hexagon_angles.svg/1101px-Regular_hexagon_angles.svg.png

The one we're interested in is the CDF one. CDF forms a 30-60-90 triangle with a short side as an edge of the hex (CD) and the size across the entire hexagon as the hypotenuse (CF). The sine of a 30 degree angle, like the one at F, will be 0.5. The sine of an angle equals the opposite / hypotenuse, which would be CD and CF, respectively. What this means, then, is that CD is half the size of CF.

This also means that our hexagon is as far across as twice the length of a hexagon side, as well. This will even be the size of our canvas on each edge. Two corners of the hexagon should sit exactly in the center of opposite edges of your canvas (e.g. A and D), while the others should make centered hexagon sides on the edges of the canvas (e.g. EF and BC).

You can place the corners of the hexagon on the edges of the canvas using this information to make your tiles.

tl;dr: For a given regular hexagon with side length s, a canvas that's just big enough to surround it will be a square with side length 2*s.

/r/Unity2D Thread