Mesh.normals 网格法线
var normals : Vector3[]
Description描述
The normals of the mesh.
网格的法线
If the mesh contains no normals an empty array will be returned.
如果网格不包含法线,一个空的数组将会被返回。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public float speed = 100.0F;
void Update() {
Mesh mesh = GetComponent<MeshFilter>().mesh;
Vector3[] normals = mesh.normals;
Quaternion rotation = Quaternion.AngleAxis(Time.deltaTime * speed, Vector3.up);
int i = 0;
while (i < normals.Length) {
normals[i] = rotation * normals[i];
i++;
}
mesh.normals = normals;
}
}
// Rotate the normals by speed every frame
//以speed速度每帧旋转法线
var speed = 100.0;
function Update () {
var mesh : Mesh = GetComponent(MeshFilter).mesh;
var normals : Vector3[] = mesh.normals;
var rotation : Quaternion = Quaternion.AngleAxis(Time.deltaTime * speed, Vector3.up);
for (var i = 0; i < normals.Length; i++)
normals[i] = rotation * normals[i];
mesh.normals = normals;
}
最后修改:2010年12月9日 Thursday 16:32