I was having problems with this so here is a variant that also allows you to specify a different offset after centering.
BTW. It would be handy if blitz exposed the mesh bounds it calculates.
Function CorrectOffset(mesh,offx#=0,offy#=0,offz#=0) Local x#,y#,z#, surf,s,v, minx#=100000,miny#=100000,minz#=100000 Local mw#=MeshWidth(mesh), mh#=MeshHeight(mesh), md#=MeshDepth(mesh) For s=1 To CountSurfaces(mesh) surf=GetSurface(mesh,s) For v=0 To CountVertices(surf)-1 x=VertexX(surf,v) y=VertexY(surf,v) z=VertexZ(surf,v) If x<minx Then minx=x If y<miny Then miny=y If z<minz Then minz=z Next Next TFormPoint minx+mw*0.5-offx,miny+mh*0.5-offy,minz+md*0.5-offz,mesh,GetParent(mesh) TranslateEntity mesh,TFormedX(),TFormedY(),TFormedZ() FitMesh mesh,-mw*0.5+offx,-mh*0.5+offy,-md*0.5+offz,mw,mh,md End Function
BTW. It would be handy if blitz exposed the mesh bounds it calculates.