ModelData:getTriangles
EditReturns the data for all triangles in the model. There are a few differences between this and the mesh-specific functions like ModelData:getMeshVertex
and ModelData:getMeshIndex
:
- Only vertex positions are returned, not other vertex attributes.
- Positions are relative to the origin of the whole model, instead of local to a node.
- If a mesh is attached to more than one node, its vertices will be in the table multiple times.
- Vertex indices will be relative to the whole triangle list instead of a mesh.
vertices, indices = ModelData:getTriangles()
Arguments
None
Returns
Name | Type | Description |
vertices | table | The triangle vertex positions, returned as a flat (non-nested) table of numbers. The position of each vertex is given as an x, y, and z coordinate. |
indices | table |
A list of numbers representing how to connect the vertices into triangles. Each number is a 1-based index into the vertices table, and every 3 indices form a triangle.
|
Notes
After this function is called on a ModelData once, the result is cached.