Hello,
I’ve built a hexagon grid using some coordinates that I input into the game. However, the algorithm I’m using to place these doesn’t appear to be how I want it.
This is how it places them currently:
I would like the X axis to be horizontal, however it currently goes diagonal lower-right. This is how I would like it to be:
As you can see, the X axis is horizontal, with every odd on a negative placement (1,0… 3,0… 5,0… etc).
This is the algorithm I’m using:
public static Vector3 HexCoordinateToWorld(Vector2 _coordinates){
float _sqrt32 = (float)Mathf.Sqrt(3)/2;
float _size = 40.24f;
float _x = _size * (float)_coordinates.x * 1.5f;
float _y = _size * (2 * _coordinates.y - _coordinates.x) * _sqrt32;
return new Vector3(_x, 0, _y);
}