NodeManager.CorrectPosition C# (CSharp) Method

CorrectPosition() public method

Corrects the Y position of the Vector3 to layer correctly with the rest of the map. Does not use the original Y value of the vecotor.
public CorrectPosition ( Vector3 vector ) : Vector3
vector Vector3 The original position of the object
return Vector3
    public Vector3 CorrectPosition(Vector3 vector)
    {
        Node node = GetNodeFromLocation(vector);
        if (node == null)
        {
            throw new Exception("could node find node for position " + vector.x + ", " + vector.y);
        }

        // perfect for non mind control
        float yVariance = (float)node.listIndexY / (float)size_y;
        float correctedY = - (yVariance + ((float)node.listIndexX % 2 == 1 ? ((((float)node.listIndexY + 1f) / (float)size_y) - yVariance) / 2f : 0f));
        return new Vector3(vector.x, correctedY, vector.z);
    }