|
using UnityEngine;
using System.Collections;
public class test : MonoBehaviour {
// Use this for initialization
void Start () {
//得到MeshFilter对象 目前是空的
MeshFilter meshFilter=(MeshFilter)GameObject.Find("face").GetComponent(typeof(MeshFilter));
//得到对应的网格对象
Mesh mesh1=meshFilter.mesh;
//三角形顶点的坐标数组
Vector3[]vertices1=new Vector3[3];
//三角形顶点ID数组
int[]triangles1=new int[3];
//三个顶点对应的坐标数组
vertices1[0]=new Vector3(0,0,0);
vertices1[1]=new Vector3(0,1,0);
vertices1[2]=new Vector3(1,0,0);
triangles1[0]=0;
triangles1[1]=1;
triangles1[2]=2;
mesh1.vertices=vertices1;
mesh1.triangles=triangles1;
}
// Update is called once per frame
void Update () {
}
}
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|