Skip to content

Instantly share code, notes, and snippets.

@TakashiYoshinaga
Last active September 21, 2017 04:24
Show Gist options
  • Save TakashiYoshinaga/21c11ddcf2e45005babd31ee30661707 to your computer and use it in GitHub Desktop.
Save TakashiYoshinaga/21c11ddcf2e45005babd31ee30661707 to your computer and use it in GitHub Desktop.
//もともとあったコード。m_meshに頂点情報(座標と順番)や色情報を渡している
m_mesh.Clear();
m_mesh.SetVertices(m_meshVertices);
m_mesh.SetIndices(m_meshIndices.ToArray(), MeshTopology.Triangles, 0);
m_mesh.SetColors(m_meshColors);
//下記の2行を新たに追加。上記で作成した三角形の集合をコライダーに反映
//Add following 2 lines. This cord attaches triangular mesh information to collider.
GetComponent<MeshCollider>().sharedMesh = null;
GetComponent<MeshCollider>().sharedMesh = m_mesh;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment