Unity 中的 Mesh 及绘制圆环

您所在的位置:网站首页 画一个敌人 Unity 中的 Mesh 及绘制圆环

Unity 中的 Mesh 及绘制圆环

2024-07-17 14:42| 来源: 网络整理| 查看: 265

Mesh 又称网格组件, 是 Unity 中一个重要的概念。

什么是 Mesh:简单的说,3D 模型上一个个的网格就是 Mesh 。3D 模型是由多边形拼接而成的, 而多边形是由多个三角形拼接而成。我们将构成这些三角行的点以及边的集合称为 Mesh 。

如下图所示:

惯例我们看看官方文档Mesh

A class that allows creating or modifying meshes from scripts.

可以通过Mesh类从脚本创建或修改网格。

Meshes contain vertices and multiple triangle arrays.

网格包含了顶点集合和多个三角形数组。

The triangle arrays are simply indices into the vertex arrays; three indices for each triangle.

三角形数组是顶点数组的简单索引; 每个三角形包含三个索引。

For every vertex there can be a normal, two texture coordinates, color and tangent. These are optional though and can be removed at will. All vertex information is stored in separate arrays of the same size, so if your mesh has 10 vertices, you would also have 10-size arrays for normals and other attributes.

每个顶点可以有一条法线, 两个纹理坐标, 颜色以及切线。这些参数都是可选的。所有的顶点信息被存储在相同规格的数组中,如果你的网格有10个顶点,你应该用大小为10的数组存储法线和其他属性。

There are probably 3 things you might want to use the modifyable mesh interface for:

一般使用可修改的网格接口做三件事情:

Building a mesh from scratch: should always be done in the following order:

a) assign vertices

b) assign triangles.

新建一个网格:按照下文的顺序做:

a)为顶点数组赋值

b) 为三角形数组赋值

using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { public Vector3[] newVertices; public Vector2[] newUV;


【本文地址】


今日新闻


推荐新闻


    CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3