Hi everyone! 
I’m working in a hexagon table and everything was fine until I needed convert mouse position into a array position hexagon.
I’m assuming that all maps started in 0,0,0 position in world space. This method get me the hexagon position in my array.
The problem, I think, is if you move away the cursor (in the corners, for example), the selected hexagon it’s really away of the real position of the mouse.
I composed this images to illustrate better the problem, this with the mouse near to center screen:

And there with the mouse near to right-up corner

This is the code:
public Vector2 GetMousePosition()
{
Vector2 mousePos = Vector2.zero;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
Plane plane = new Plane(Vector3.up, Vector3.zero);
float hitdist = 0f;
if (plane.Raycast(ray, out hitdist))
{
Vector3 targetPoint = ray.GetPoint(hitdist);
float y = targetPoint.z * selector.GetHexaSize().y * .75f;
float offset = y % 2 != 0 ? selector.GetHexaSize().x / 2f : 0;
float x = targetPoint.x / selector.GetHexaSize().x - offset;
mousePos = new Vector2
(
Mathf.CeilToInt(x),
Mathf.CeilToInt(y)
);
}
else
{
mousePos = new Vector3(0, -256, 0);
}
return mousePos;
}
I don’t want raycast mesh colliders, because in the final game, the hexagon map that you can see it’s only helper tools for developer and all things doing through the array.
Thanks for your help! 

Did you manage to solve it? I ran into the same issue; I used this source to find the solution. Do note that this only works for horizontally alligned hexagon grids.
/// <summary> Convert hexagon grid position to grid coordinate </summary>
public static Vector2Int HexagonGridToCoordinate (Properties data, Vector2 position)
{
Vector2Int coordinate;
int y = (int)(position.y / data.RowHeight);
int modulusY = y % 2;
int x = 0;
if (modulusY == 0)
{
x = (int)(position.x / data.Width);
}
else
{
x = (int)((position.x - data.HalfWidth) / data.Width);
}
coordinate = new Vector2Int(x, y);
return coordinate;
}
/// <summary> Convert grid coordinate to hexagon grid position </summary>
public static Vector2 CoordinateToHexagonGrid (Properties data, Vector2Int position)
{
Vector2 gridPosition;
// determine if in odd or even rows
int modulusY = position.y % 2;
float x = 0;
if (modulusY == 0)
{
x = position.x * data.Width;
}
else
{
x = data.HalfWidth + position.x * data.Width;
}
// doesn't matter for horizontally alligned hexagons
float y = position.y * data.RowHeight;
gridPosition = new Vector2(x, y);
return gridPosition;
}
/// <summary> Define the properties of the hexagons based on the radius (probably 0.5f) </summary>
public struct Properties
{
public float Radius;
public float Height;
public float RowHeight;
public float HalfWidth;
public float Width;
public float ExtraHeight;
public Properties (float radius)
{
Radius = radius;
Height = 2 * Radius;
RowHeight = 1.5f * Radius;
HalfWidth = Mathf.Sqrt(Radius * Radius - (Radius / 2) * (Radius / 2));
Width = 2 * this.HalfWidth;
ExtraHeight = Height - RowHeight;
}
// http://barankahyaoglu.com/dev/coordinate-calculations-in-hexagonal-world/
}
Also, if you want to convert a raw world position to a hexagon grid position, then use the following function.
/// <summary> Round position to hexagon grid position </summary>
public static Vector2 WorldToHexagonGrid (Properties data, Vector2 position)
{
// find rounded off position
Vector2Int coordinate = HexagonGridToCoordinate(data, position);
Vector2 hexagon = CoordinateToHexagonGrid(data, coordinate);
// get neighbors of this pos
List<Vector2> hexagonPositions = new List<Vector2>
{
// top left
new Vector2(hexagon.x - data.HalfWidth, hexagon.y + data.RowHeight),
// top right
new Vector2(hexagon.x + data.HalfWidth, hexagon.y + data.RowHeight),
// left
new Vector2(hexagon.x - data.Width, hexagon.y),
// middle
hexagon,
// right
new Vector2(hexagon.x + data.Width, hexagon.y),
// bottom left
new Vector2(hexagon.x - data.HalfWidth, hexagon.y - data.RowHeight),
// bottom right
new Vector2(hexagon.x + data.HalfWidth, hexagon.y - data.RowHeight)
};
// find the position closest to the raw position
Vector2 closest = Vectors.ClosestPosition(position, hexagonPositions);
return closest;
}
Here’s the Vectors.ClosestPosition function as well.
/// <summary> Find the closest object to a position </summary>
public static Vector2 ClosestPosition(Vector2 position, List<Vector2> objects)
{
float shortestDistance = Vector2.Distance(position, objects[0]);
Vector2 Closest = objects[0];
for (int i = 0; i < objects.Count; i++)
{
float newDistance = Vector2.Distance(position, objects[i]);
if (newDistance < shortestDistance)
{
Closest = objects[i];
shortestDistance = newDistance;
}
}
return Closest;
}
Might be handy to include this as well:
/// <summary> Define the properties of the hexagons based on the radius (probably 0.5f) </summary>
public struct Properties
{
public float Radius;
public float Height;
public float RowHeight;
public float HalfWidth;
public float Width;
public float ExtraHeight;
public Properties(float radius)
{
Radius = radius;
Height = 2 * Radius;
RowHeight = 1.5f * Radius;
HalfWidth = Mathf.Sqrt(Radius * Radius - (Radius / 2) * (Radius / 2));
Width = 2 * this.HalfWidth;
ExtraHeight = Height - RowHeight;
}
// http://barankahyaoglu.com/dev/coordinate-calculations-in-hexagonal-world/
}