natiny.model.set_mesh

Lua
natiny.model.set_mesh(model, mesh)

Sets which geometry this model places.

Parameters

Name Type Description
model number Model handle
mesh number Mesh handle, or 0 to empty the model

Example

Lua
natiny.model.set_mesh(box, sphere_mesh)

Notes

  • A model with no mesh draws nothing and is skipped by every pass; 0 puts it back in that state without destroying it.
  • Any per-part overrides set with set_part_material or set_part_texture are cleared, because they were indexed by the old mesh's parts and mean nothing against the new one's.
  • The mesh is not copied. Several models may point at one, and destroying the mesh leaves them drawing nothing rather than crashing.