As far as how materials work in my terrain mesh stuff, I decided it was easiest to assign by texture, so areas that looked like dirt would have some different properties than grass areas. Of course, its not foolproof. You can also set the material of a particular mesh or a default material for a particular mesh in the case that there is no material for a texture.
Const GroundMat = 0 Const WallMat = 1 toksim_SetMaterial GroundMat,0.8,0.01 toksim_SetMaterial WallMat,0.2,0.8 TOK_SetTextureMaterial("Ground.jpg",GroundMat) TOK_SetTextureMaterial("Wall1.png",WallMat) TOK_SetTextureMaterial("Wall2.png",WallMat) TOK_AddMesh LoadMesh("Level.3ds") TOK_SetMesh