natiny.model.create
Lua
natiny.model.create([mesh [, material]]) -> model
Creates a model: a mesh instance placed in the scene. A model handle is also an
entity handle, so natiny.entity functions can transform and parent it.
Parameters
| Name |
Type |
Default |
Description |
mesh |
number |
nil |
Mesh handle whose geometry this model places |
material |
number |
nil |
Material handle; without one, the built-in material is used |
Returns
| Type |
Description |
number |
Model handle, also usable as an entity handle |
Example
Lua
local box = natiny.model.create(geom, stone)
Notes
- A model starts at the world origin, white, visible, and empty when no mesh
was given. An empty model draws nothing, so filling one in over several
statements is safe.
- Any number of models may share one mesh: geometry is an asset and is stored
once however many places it appears.
- Without a material, a model uses the built-in material and its
"model"
tag.
- Lua raises an error if the model cannot be created.