我正在通过在每个帧上向其自身添加每个顶点的法线来生成3D模型。该模型在视觉上显然会增大大小,但是在注销边界时它们不会改变。
using UnityEngine;
public class VertexExperiment : MonoBehaviour
{
private Mesh mesh;
private Renderer renderer;
void Start()
{
mesh = gameObject.GetComponent<MeshFilter>().mesh;
renderer = gameObject.GetComponent<Renderer>();
}
void Update()
{
Vector3[] vertices = mesh.vertices;
for (int i = 0; i < vertices.Length; i++)
{
Vector3 normal = vertices[i].normalized;
vertices[i] = vertices[i] + normal;
}
mesh.vertices = vertices;
print(renderer.bounds.size);
print(mesh.bounds.size);
}
}
注销值的结果
答案 0 :(得分:1)