ok i tried the save .x with these mods
function saveMesh(id as integer,filename as string )
t as integer:mesh as integer:n as integer: s as integer:verts as integer:i as integer
x# as float:y# as float:z# as float:end$ as string:b$ as string:name as string
nx# as float:ny# as float:nz# as float:u# as float:v# as float
name = "raw:"+GetReadPath()+"media/"+filename
print("Creating : "+name)
//OpenToWrite ( 1, "raw:"+GetReadPath()+"media\20cajas.x", 0 )
OpenToWrite(1,name,0)
writeline( 1,"xof 0303txt 0032")
writeline(1,"") `space
writeline(1,"#Save boxes to .x by Chafari ")
writeline(1,"#Made in AGK2 December 2018")
writeline(1,"") `space
//for t= 1 to 370 `No hay tantos objetos, pero hacemos un rastreo largo por ver si el objeto existe
t=id
n=0
s=0
if GetObjectExists(t)
mesh = CreateMemblockFromObjectMesh(t,1)
`number of vertex
verts= GetMemblockInt( mesh, 0 )
`VERTICES
writeline(1,"Mesh {")
writeline(1, str(verts) + ";")
for i= 0 to verts-1
x#=GetMeshMemblockVertexX(mesh,i)
y#=GetMeshMemblockVertexy(mesh,i)
z#=GetMeshMemblockVertexz(mesh,i)
`vertex
if i < verts - 1 then end$ = ";," else end$ = ";;"
writeline( 1, str(x#, 6) + ";" + str(y#, 6) + ";" + str(z#, 6) + end$)
next i
`FACES
writeline(1,"12;")
for i= 0 to 18
inc s
if s=3
writeline(1,str(3)+";"+str(n+2)+","+str(n+1)+","+str(n)+";,")
if i<16 then b$=";," else b$=";;"
writeline(1,str(3)+";"+str(n+3)+","+str(n+1)+","+str(n+2)+b$)
n=n+1
s=0
n=n+3
endif
next
n=0 `reset n
`----------------------------------------------------------------------------
`NORMALES
writeline(1,"MeshNormals {")
writeline(1, str(verts) + ";")
for i= 0 to verts-1
nx#=GetMeshMemblockVertexNormalX(mesh,i)
ny#=GetMeshMemblockVertexNormaly(mesh,i)
nz#=GetMeshMemblockVertexNormalz(mesh,i)
`Normals
if i < verts - 1 then end$ = ";," else end$ = ";;"
writeline( 1, str(nx#, 6) + ";" + str(ny#, 6) + ";" + str(nz#, 6) + end$)
next i
writeline(1,"12;")
for i= 0 to 18
inc s
if s=3
writeline(1,str(3)+";"+str(n+2)+","+str(n+1)+","+str(n)+";,")
if i<16 then b$=";," else b$=";;"
writeline(1,str(3)+";"+str(n+3)+","+str(n+1)+","+str(n+2)+b$)
n=n+1
s=0
n=n+3
endif
next
writeline(1,"}")
`COORDENADAS DE TEXTURA
writeline(1,"MeshTextureCoords {")
writeline(1, str(verts) + ";")
for i= 0 to verts-1
U#=GetMeshMemblockVertexU(mesh,i)
V#=GetMeshMemblockVertexV(mesh,i)
`UV
if i < verts - 1 then end$ = ";," else end$ = ";;"
writeline( 1, str(U#, 6) + ";" + str(V#, 6) + end$)
next
writeline(1,"}")
writeline(1," MeshMaterialList { ")
writeline(1," 1;")
writeline(1," 1;")
writeline(1," 0;;")
writeline(1," Material Material {")
writeline(1," 0.640000; 0.640000; 0.640000; 1.000000;;")
writeline(1," 96.078431;")
writeline(1," 0.500000; 0.500000; 0.500000;;")
writeline(1," 0.000000; 0.000000; 0.000000;;")
//writeline(1," TextureFilename {" + chr(34)+ str(t)+".png" + chr(34)+ ";}") `different texture per limb... 1.png, 2.png 3.png etc etc.
`to import all meshes (limbs) in AGK , as AGK will cosider all meshes with same texture as the same mesh (limb)
writeline(1," TextureFilename {" + chr(34)+"test.png" + chr(34)+ ";}") `saving a texture for the whole object
writeline(1," }")
writeline(1," }")
writeline(1,"}")
writeline(1,"//------------------new mesh -------------------------")
DeleteMemblock(t)
endif
// next
CloseFile ( 1 )
endfunction
and get this with the (single plane) mesh im exporting