void baseOffMeshLinks(MeshTile tile) {
        if (tile == null) {
            return;
        }

        long base = getPolyRefBase(tile);

        // Base off-mesh connection start points.
        for (int i = 0; i < tile.data.header.offMeshConCount; ++i) {
            OffMeshConnection con = tile.data.offMeshCons[i];
            Poly poly = tile.data.polys[con.poly];

            float[] ext = new float[] { con.rad, tile.data.header.walkableClimb, con.rad };

            // Find polygon to connect to.
            FindNearestPolyResult nearestPoly = findNearestPolyInTile(tile, con.pos, ext);
            long ref = nearestPoly.getNearestRef();
            if (ref == 0) {
                continue;
            }
            float[] p = con.pos; // First vertex
            float[] nearestPt = nearestPoly.getNearestPos();
            // findNearestPoly may return too optimistic results, further check
            // to make sure.
            if (sqr(nearestPt[0] - p[0]) + sqr(nearestPt[2] - p[2]) > sqr(con.rad)) {
                continue;
            }
            // Make sure the location is on current mesh.
            tile.data.verts[poly.verts[0] * 3] = nearestPt[0];
            tile.data.verts[poly.verts[0] * 3 + 1] = nearestPt[1];
            tile.data.verts[poly.verts[0] * 3 + 2] = nearestPt[2];

            // Link off-mesh connection to target poly.
            int idx = allocLink(tile);
            Link link = tile.links.get(idx);
            link.ref = ref;
            link.edge = 0;
            link.side = 0xff;
            link.bmin = link.bmax = 0;
            // Add to linked list.
            link.next = poly.firstLink;
            poly.firstLink = idx;

            // Start end-point is always connect back to off-mesh connection.
            int tidx = allocLink(tile);
            int landPolyIdx = decodePolyIdPoly(ref);
            Poly landPoly = tile.data.polys[landPolyIdx];
            link = tile.links.get(tidx);
            link.ref = base | (con.poly);
            link.edge = 0xff;
            link.side = 0xff;
            link.bmin = link.bmax = 0;
            // Add to linked list.
            link.next = landPoly.firstLink;
            landPoly.firstLink = tidx;
        }
    }
void baseOffMeshLinks ( MeshTile tile ) { if ( tile == null ) { return ; } long base = getPolyRefBase ( tile ) ; for ( int i = 0 ; i < tile . data . header . offMeshConCount ; ++ i ) { OffMeshConnection con = tile . data . offMeshCons [ i ] ; Poly poly = tile . data . polys [ con . poly ] ; float [ ] ext = new float [ ] { con . rad , tile . data . header . walkableClimb , con . rad } ; FindNearestPolyResult nearestPoly = findNearestPolyInTile ( tile , con . pos , ext ) ; long ref = nearestPoly . getNearestRef ( ) ; if ( ref == 0 ) { continue ; } float [ ] p = con . pos ; float [ ] nearestPt = nearestPoly . getNearestPos ( ) ; if ( sqr ( nearestPt [ 0 ] - p [ 0 ] ) + sqr ( nearestPt [ 2 ] - p [ 2 ] ) > sqr ( con . rad ) ) { continue ; } tile . data . verts [ poly . verts [ 0 ] * 3 ] = nearestPt [ 0 ] ; tile . data . verts [ poly . verts [ 0 ] * 3 + 1 ] = nearestPt [ 1 ] ; tile . data . verts [ poly . verts [ 0 ] * 3 + 2 ] = nearestPt [ 2 ] ; int idx = allocLink ( tile ) ; Link link = tile . links . get ( idx ) ; link . ref = ref ; link . edge = 0 ; link . side = 0xff ; link . bmin = link . bmax = 0 ; link . next = poly . firstLink ; poly . firstLink = idx ; int tidx = allocLink ( tile ) ; int landPolyIdx = decodePolyIdPoly ( ref ) ; Poly landPoly = tile . data . polys [ landPolyIdx ] ; link = tile . links . get ( tidx ) ; link . ref = base | ( con . poly ) ; link . edge = 0xff ; link . side = 0xff ; link . bmin = link . bmax = 0 ; link . next = landPoly . firstLink ; landPoly . firstLink = tidx ; } }
Builds internal polygons links for a tile.

@param tile