you can get the geometry from physbody by using the Mesh class or is it meshbase that allows creating a mesh from physbody.

I created this along time ago when creating my own worldmanager(not sure it compiles without altering some functions first).

Code:

`static void SetDefaultPathType(MeshBase &mesh){`

if (!mesh.tri.flag()){ mesh.include(TRI_FLAG); REPA(mesh.tri)mesh.tri.flag(i) = PM_GROUND; }

if (!mesh.quad.flag()){ mesh.include(QUAD_FLAG); REPA(mesh.quad)mesh.quad.flag(i) = PM_GROUND; }

}

static void CreatePath(Cell<Area> &cell,Ptr=nullptr){

Area *a = nullptr;

if(!(a = cell.data()))return;

MeshBase mesh; mesh.add(MeshBase(a->phys));

if(a->l() )mesh.add(MeshBase(a->l()->phys));

if(a->r() )mesh.add(MeshBase(a->r()->phys));

if(a->b() )mesh.add(MeshBase(a->b()->phys));

if(a->f() )mesh.add(MeshBase(a->f()->phys));

if(a->lb())mesh.add(MeshBase(a->lb()->phys));

if(a->lf())mesh.add(MeshBase(a->lf()->phys));

if(a->rb())mesh.add(MeshBase(a->rb()->phys));

if(a->rf())mesh.add(MeshBase(a->rf()->phys));

SetDefaultPathType(mesh);

Rect drect(a->mat.pos.xz()-2,a->mat.pos.xz()+(World.HMRes()+1)); //create a scaled rectangle used for cutting edge geometry from neigbouring areas to prevent navmesh generation on excessive amount of data.

if(!drect.validX())Swap(drect.min.x, drect.max.x);

if(!drect.validY())Swap(drect.min.y, drect.max.y);

Mems<Bool> vtx_is;vtx_is.setNumZero(mesh.vtxs());

REPA(mesh.vtx){

if(Cuts(mesh.vtx.pos(i).xz(), drect)){

if(InRange(i, vtx_is))vtx_is[i]=true;

}

}

Mesh d;d.add(mesh);

mesh.create(d.splitVtx(0, vtx_is.data()));

mesh.weldVtx();

a->pm.create(mesh,a->_xz,World.ps);//path mesh

a->Save();

mesh.del();

d.del();

}