Mesh.GetTriangles

切换到手册
public int[] GetTriangles (int submesh);
public int[] GetTriangles (int submesh, bool applyBaseVertex= true);
public void GetTriangles (List<int> triangles, int submesh, bool applyBaseVertex= true);
public void GetTriangles (List<int> triangles, int submesh);

参数

triangles要填充的顶点索引的列表。
submeshThe sub mesh on this instance. See subMeshCount.
applyBaseVertexTrue (default) value will apply base vertex offset to returned indices.

描述

Gets the triangle list for the specified sub mesh on this instance.

Each element value in the returned triangle list refers to a vertex index, which can be used to index into the results of other accessors like vertices and GetVertices. It will return indices in multiples of three.

A sub mesh is simply a separate triangle list. When the mesh is rendered using multiple materials, you should ensure that there is one sub mesh per Material.

如果要控制索引缓冲区的生命周期并且需要避免在每次访问时都分配新数组,请使用 List<int> 参数调用方法重载。

另请参阅:subMeshCount

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961