Unity3d学习10
来源:互联网 发布:淘宝申请客服介入流程 编辑:程序博客网 时间:2024/06/15 21:38
1.绘制不规则平面
using UnityEngine;
usingSystem.Collections;
public classPlaneDraw_CTRL : MonoBehaviour
{
publicGameObject planeDraw;
MeshplaneDraw_mesh;
//Use this for initialization
voidStart ()
{
planeDraw_mesh= planeDraw.GetComponent<MeshFilter> ().mesh;
Vector3[]test = new Vector3[8];
test[0] = new Vector3 (4f,0,0);
test[1] = new Vector3 (10f,0,0);
test[2] = new Vector3 (2f,0,0);
test[3] = new Vector3 (6f,0,0);
test[4] = new Vector3 (3f,1f,0);
test[5] = new Vector3 (2f,2f,0);
test[6] = new Vector3 (1f,5f,0);
test[7] = new Vector3 (1f,20f,0f);
drawPlane(test);
}
//Update is called once per frame
voidUpdate ()
{
}
publicvoid drawPlane(Vector3[] vertices)
{
intnumberOfTriangles = vertices.Length - 2;
int[]triangles = new int[numberOfTriangles*3];
intf = 0, b = vertices.Length - 1;
intm = (vertices.Length + 1) / 2;
for(inti=1; i<=numberOfTriangles; i++)
{
if(i%2==1)
{
triangles[3*i-3]= f++;
triangles[3*i-2]= f;
triangles[3*i-1]= b;
}
else
{
triangles[3*i-1]= b--;
triangles[3*i-2]= b;
triangles[3*i-3]= f;
}
}
planeDraw_mesh.vertices= vertices;
planeDraw_mesh.triangles= triangles;
}
}
- UNITY3D学习笔记10
- Unity3d学习10
- Unity3D 学习
- Unity3D学习
- Unity3D 学习
- Unity3d学习
- Unity3D学习
- Unity3D学习
- unity3D 学习
- unity3D学习
- unity3D学习
- Unity3D学习笔记10:Unity调用DLL
- Unity3D 学习教程 10 复制物体
- unity3d基础学习笔记10:socket概述
- Unity3D 学习资料收集
- unity3d学习(一)
- unity3d学习(四)
- Unity3D学习系列教程
- 光纤网卡、HBA卡和RAID卡的区别
- Maven配置——增删(自动)更新依赖
- js使点击网页其他地方使显示框消失
- JSP中文乱码问题终极解决方案
- 变种XSS:持久控制
- Unity3d学习10
- 用vsprintf 实现LCD格式化输出
- android 中关于Phone的ACTION_CALL、ACTION_CALL_PRIVILEGED、ACTION_DIAL的区别
- java 根据图片地址获取到图片的大小,单位kb或者Mb
- 12个互联网大脑计划重点探索方向,互联网大脑计划系列6
- TortoiseSVN客户端重新设置用户名和密码
- SQLite数据类型详解
- ATL入门之配置ATL环境
- 抽象与接口的区别