Mesh.RecalculateBounds 重新计算包围体

function RecalculateBounds () : void

Description描述

Recalculate the bounding volume of the mesh from the vertices.

重新计算从网格包围体的顶点。

After modifying vertices you should call this function to ensure the bounding volume is correct. Assigning triangles will automatically Recalculate the bounding volume.

在修改顶点后你应该点用这个函数以确保包围体是恰当的。赋值三角形将自动重新计算这个包围体。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Start() {
		Mesh mesh = GetComponent<MeshFilter>().mesh;
		mesh.RecalculateBounds();
	}
}
function Start () {
	var mesh : Mesh = GetComponent(MeshFilter).mesh;
	mesh.RecalculateBounds();
}
Page last updated: 2010-12-9