public void CalcTileLoc(ref Vector3 pos, out int tx, out int ty) { tx = (int)Math.Floor((pos.X - origin.X) / tileWidth); ty = (int)Math.Floor((pos.Z - origin.Z) / tileHeight); }