Several materails with AngelScript

Hi, simple question:
if i implementing model with one material via AngelScript, it’s look like this:

jack.material = cache.GetResource(“Material”, “mat.xml”);

But how about models with several matarials? How attach second material of model for example?

Use the set_materials method which accepts the index of the material.The number of materials should be equal to number of vertex buffers per model

jack.set_materials(0 ,  cache.GetResource(“Material”, “mat.xml”));
jack.set_materials(1 ,  cache.GetResource(“Material”, “mat2.xml”));
jack.set_materials(2 ,  cache.GetResource(“Material”, “mat3.xml”));
1 Like

set_* and get_* methods are internal property accessors.
Just use properties: jack.materials[0]

1 Like

u can use ApplyMaterialList() for models with multiple materials (blender can generate this list)