natiny.model.set_material

Lua
natiny.model.set_material(model [, material])

Sets the material for every part of the model, and with it the tags that decide which passes draw the model.

Parameters

Name Type Default Description
model number Model handle
material number 0 Material handle, or 0 for the built-in material

Example

Lua
natiny.model.set_material(box, stone)

Notes

  • Materials belong to model instances, not meshes; models sharing one mesh may use different materials.
  • Selection by tag reads this material and only this one. Per-part overrides from set_part_material change how a part is shaded, not whether the model is picked up.
  • 0 goes back to the built-in material, which carries the tag "model" and nothing else.
  • A material bound with natiny.material.bind overrides this for the length of the bind: the tag chooses which models a pass draws, the bound material chooses how.