一、创建一个Cube
二、新建个脚本挂在Cube上
using UnityEngine;
using System.Collections;
public class MeshTest : 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;
}
}