NodeManager.CorrectInitialPosition C# (CSharp) Method

CorrectInitialPosition() public method

Corrects the Y position of the Vector3 to layer correctly with the rest of the map. Uses the original Y value of the vector.
public CorrectInitialPosition ( Vector3 vector ) : Vector3
vector Vector3 The original position of the object
return Vector3
    public Vector3 CorrectInitialPosition(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 = vector.y - (yVariance + ((float)node.listIndexX % 2 == 1 ? ((((float)node.listIndexY + 1f) / (float)size_y) - yVariance) / 2f : 0f));
        return new Vector3(vector.x, correctedY, vector.z);
    }