資源簡介
用Unity3d自身來繪制扇形網格,簡單的腳本。
代碼片段和文件信息
using?UnityEngine;
using?System.Collections;
using?System.Collections.Generic;
/**
?*?create?by?yingyugang?(232871714@qq.com)?
?*?2014.12.01
?**/
public?static?class?MeshUtility?{
static?Gameobject?GetMeshGameobject(Material?meshMaterialColor?color)
{
Gameobject?go?=?new?Gameobject?();
MeshRenderer?meshRenderer?=?go.AddComponent();
if(meshMaterial==null)
{
Shader?meshShader?=?Shader.Find(“Diffuse“);
meshMaterial?=?new?Material(meshShader);
}
meshMaterial.color?=?color;
meshRenderer.material?=?meshMaterial;
meshRenderer.sharedMaterial?=?meshMaterial;
go.AddComponent();
return?go;
}
public?static?Gameobject?DrawSectorGameobject(Material?meshMaterialColor?colorfloat?anglefloat?radiusLongfloat?radiusShort)
{
radiusLong?=?Mathf.Abs?(radiusLong);
radiusShort?=?Mathf.Abs?(radiusShort);
if?(radiusLong? float?temp?=?radiusShort;
radiusShort?=?radiusLong;
radiusLong?=?temp;
}
Gameobject?go?=?Get
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????3657??2014-12-14?00:11??DrawSector.html
?????文件??????109934??2014-12-14?00:11??DrawSector.unity3d
?????文件????????7232??2014-12-13?23:42??MeshUtility.cs
?????文件????????1494??2014-12-14?00:10??MeshUtilityDemo.cs
- 上一篇:蓄滿產流分層計算模型
- 下一篇:NewsApp源碼
評論
共有 條評論