natiny_model_destroy
void natiny_model_destroy(NatinyModel model);
Frees a model and the node that carried it.
Parameters
| Name | Type | Description |
|---|---|---|
model |
NatinyModel |
Model handle |
Example
natiny_model_destroy(box);
Notes
- The mesh and the materials the model pointed at are left alone. They are assets, shared with whatever else uses them, and not this model's to free - use natiny_mesh_destroy for the geometry.
- Everything parented to the model is destroyed with it, and so is everything parented to those, all the way down. Each one goes through the destroy its own kind has, so a child model gives back its parts, a child body leaves the physics world and a child source releases its voice - a subtree is freed as completely as its nodes would be one at a time.
- Detach a child to keep it:
natiny_entity_set_parent(child, 0)leaves its local transform as its world transform, and the destroy passes it by. - Destroying a model twice does nothing the second time.