natiny.model.set_part_material

Lua
natiny.model.set_part_material(model, part [, material])

Overrides the material of one part of the model.

Parameters

Name Type Default Description
model number Model handle
part integer Zero-based part index; negative values are clamped to 0
material number 0 Material handle, or 0 to inherit the model material

Example

Lua
natiny.model.set_part_material(house, 3, glass)

Notes

  • 0 clears an override.
  • This does not change which passes draw the model: tags are read from the model's own material, set with set_material.
  • Overrides are cleared by set_mesh, because they were indexed by the old mesh's parts.
  • An index past the last part is stored but never reached.