MaterialPtr mat = new Material();
mat->color = Vec4(0.2f,0.2f,0.7f,0.7f); // blue
mat->ambient = Vec(0.2f,0.2f,0.2f);
mat->specular = 0.5f;
mat->validate();
MaterialPtr mat2 = new Material();
mat2->color = Vec4(0.7f,0.2f,0.2f,0.7f); // red
mat2->ambient = Vec(0.2f,0.2f,0.2f);
mat2->specular = 0.5f;
mat2->validate();
MeshPtr mesh = new Mesh();
mesh->setAutoTanBin();
MeshPart *mp1 = &mesh->parts.New();
mp1->base.create(Box(0.3f),VTX_TEX0|VTX_NRM|VTX_TNG);
mp1->setMaterial(mat); // blue cube
MeshPart *mp2 = &mesh->parts.New();
mp2->base.create(Ball(0.3f,Vec(0.1f,0.1f,0.1f)),VTX_TEX0|VTX_NRM|VTX_TNG);
mp2->setMaterial(mat2); // red ball
//mesh->setMaterial(Materials.ptrRequire("data/mtrl/brick/0.mtrl")).setRender().setBox();
mesh->weldVtx().setAdjacencies();
mesh->removeDegenerateFaces().removeUnusedVtxs().setNormals();
mesh->setShader().setRender().setBox();
PhysBodyPtr pb = new PhysBody();
pb->parts.New().create(mesh->box);
File f;
f.write("ship.mesh");
mesh->save(f);
Game::ObjParams obj;
obj.type(true, "OBJ_VEHICLE");
obj.mesh(true, mesh);
obj.phys(true, pb);
Game::Obj *g = Game::World.objCreateNear(obj,Matrix(obj.scale(),Vec(0,0,0)));