{"id":6117,"date":"2019-08-01T10:16:05","date_gmt":"2019-08-01T01:16:05","guid":{"rendered":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/?p=6117"},"modified":"2019-08-01T10:16:05","modified_gmt":"2019-08-01T01:16:05","slug":"unity%e3%81%a7%e3%81%aemesh%e7%94%9f%e6%88%90%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/6117","title":{"rendered":"Unity\u3067\u306eMesh\u751f\u6210\u306b\u3064\u3044\u3066"},"content":{"rendered":"<div class=\"veu_autoEyeCatchBox\"><img loading=\"lazy\" decoding=\"async\" width=\"229\" height=\"119\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/08\/fig1.png\" class=\"attachment-large size-large wp-post-image\" alt=\"MeshFilter\u3068Mesh\" \/><\/div>\n<p>\u8fd1\u5e74\u3001VR\u3084AR\u306a\u3069\u304c\u6ce8\u76ee\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u306e\u3088\u3046\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3059\u308b\u969b\u3088\u304f\u5229\u7528\u3055\u308c\u308b\u3082\u306e\u3068\u3057\u3066\u300c<strong>Unity<\/strong>\u300d\u306a\u3069\u304c\u6319\u3052\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u3053\u306e\u300cUnity\u300d\u3092\u5229\u7528\u3057\u3066\u52d5\u7684\u306b\u30e1\u30c3\u30b7\u30e5\u3092\u751f\u6210\u3059\u308b\u65b9\u6cd5\u3092\u8a18\u8f09\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3><strong>MeshFilter\u3068Mesh<\/strong><\/h3>\n<p>UnityEngine\u3067\u7528\u610f\u3055\u305b\u3066\u3044\u308b\u30af\u30e9\u30b9MeshFilter\u3068Mesh<\/p>\n<p>\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u52d5\u7684\u306b\u30e1\u30c3\u30b7\u30e5\u3092\u751f\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u56f3\u306f\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u5185\u3067MeshFilter\u3068Mesh\u3092\u5229\u7528\u3057\u3001<\/p>\n<p>\u56db\u9762\u4f53\u3092\u52d5\u7684\u306b\u4f5c\u6210\u3057\u305f\u3082\u306e\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6118\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/08\/fig1.png\" alt=\"MeshFilter\u3068Mesh\" width=\"229\" height=\"119\" \/><\/p>\n<p>&nbsp;<\/p>\n<h4><strong>\u30b3\u30fc\u30c9\u5185\u3067\u306eMesh\u4f5c\u6210\u624b\u9806<\/strong><\/h4>\n<ol>\n<li>MeshFilter \u3068MeshRenderer \u3092\u4ed8\u4e0e\u3057\u305fGameObject\u3092\u4f5c\u6210<\/li>\n<li>MeshFilter\u3001Mesh\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210<\/li>\n<li>Mesh\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u9802\u70b9\u5ea7\u6a19\u3001\u6cd5\u7dda\u30d9\u30af\u30c8\u30eb\u3001\u4e09\u89d2\u5f62\u306e\u914d\u5217\u3092\u4ee3\u5165<\/li>\n<li>MeshFilter.mesh\u306bMesh\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4ee3\u5165<\/li>\n<\/ol>\n<p>\u4e0a\u8a18\u306e\u624b\u9806\u3092\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306b\u3057\u305f\u3082\u306e\u304c\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\uff12\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u6570\u884c\u306e\u30b3\u30fc\u30c9\u3067Mesh\u751f\u6210\u304c\u884c\u3048\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c91: Start\u95a2\u6570\u5185<\/p>\n<pre class=\"lang:default highlight:0 decode:true\" title=\"\u30bd\u30fc\u30b9\u30b3\u30fc\u30c91: Start\u95a2\u6570\u5185\">void Start () { \r\n        List&lt;Vector3&gt; vtcs = new List&lt;Vector3&gt;{             \r\nnew Vector3(0.0f, 1.0f, 0.0f),             \r\nnew Vector3(-1.0f, 0.0f, -1.0f),             \r\nnew Vector3(0.0f, 0.0f, 1.0f),             \r\nnew Vector3(1.0f, 0.0f, -1.0f)         \r\n};         \r\nList&lt;int&gt; pindex = new List&lt;int&gt;(){             \r\n0,1,2,             \r\n0,2,3,             \r\n0,3,1,             \r\n1,3,2         \r\n};         \r\nCreateMesh(\"tetrahedron\",vtcs, vtcs, pindex); \r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c92: Mesh\u4f5c\u6210<\/p>\n<pre class=\"lang:default highlight:0 decode:true\" title=\"\u30bd\u30fc\u30b9\u30b3\u30fc\u30c92: Mesh\u4f5c\u6210\">public void CreateMesh(string _objName,List&lt;Vector3&gt; _vtcs, List&lt;Vector3&gt; _nors, List&lt;int&gt; _pindex) \r\n{\r\n         GameObject meshObj = new GameObject(_objName, new[] { typeof(MeshFilter), typeof(MeshRenderer) });\r\n         MeshFilter mf = meshObj.GetComponent&lt;MeshFilter&gt;();         meshObj.GetComponent&lt;MeshRenderer&gt;().material.color = Color.red;\r\n         Mesh mesh = new Mesh();         \r\nmesh.vertices = _vtcs.ToArray();\r\nmesh.triangles = _pindex.ToArray();\r\nmesh.normals = _nors.ToArray();\r\nmf.mesh = mesh;\r\n }\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.ois-yokohama.co.jp\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6056\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/06\/ois_logo.jpg\" alt=\"\u30aa\u30ea\u30a8\u30f3\u30bf\u30eb\u30a4\u30f3\u30d5\u30a9\u30fc\u30e1\u30a4\u30b7\u30e7\u30f3\u30b5\u30fc\u30d3\u30b9\uff08OIS\uff09\" width=\"318\" height=\"145\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd1\u5e74\u3001VR\u3084AR\u306a\u3069\u304c\u6ce8\u76ee\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u306e\u3088\u3046\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3059\u308b\u969b\u3088\u304f\u5229\u7528\u3055\u308c\u308b\u3082\u306e\u3068\u3057\u3066\u300cUnity\u300d\u306a\u3069\u304c\u6319\u3052\u3089\u308c\u307e\u3059\u3002 \u4eca\u56de\u306f\u3001\u3053\u306e\u300cUnity\u300d\u3092\u5229\u7528\u3057\u3066\u52d5\u7684\u306b\u30e1\u30c3\u30b7\u30e5\u3092\u751f\u6210\u3059\u308b\u65b9\u6cd5\u3092\u8a18\u8f09\u3057\u305f\u3044\u3068\u601d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6118,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"vkexunit_cta_each_option":"","footnotes":""},"categories":[67],"tags":[728,727,726],"class_list":["post-6117","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-67","tag-mesh","tag-meshfilter","tag-unity"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/6117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/comments?post=6117"}],"version-history":[{"count":1,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/6117\/revisions"}],"predecessor-version":[{"id":6119,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/6117\/revisions\/6119"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/media\/6118"}],"wp:attachment":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/media?parent=6117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/categories?post=6117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/tags?post=6117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}