回答編集履歴

1

表示できるサンプル作ってみました

2017/12/22 12:11

投稿

rururu3
rururu3

スコア5545

test CHANGED
@@ -1,3 +1,87 @@
1
1
  座標データがどうなってるかわからないのでアドバイスになりますが、
2
2
 
3
3
  Cullingのせいな気もしますので、とりあえず最低限である3頂点(1ポリゴン)で表示できるところから確認されてはいかがでしょうか。
4
+
5
+
6
+
7
+ 表示できるサンプル作ってみました
8
+
9
+ ```
10
+
11
+ using System.Collections;
12
+
13
+ using System.Collections.Generic;
14
+
15
+ using UnityEngine;
16
+
17
+
18
+
19
+ [RequireComponent(typeof(MeshRenderer))]
20
+
21
+ [RequireComponent(typeof(MeshFilter))]
22
+
23
+ public class MeshTest : MonoBehaviour
24
+
25
+ {
26
+
27
+ protected Mesh mesh;
28
+
29
+
30
+
31
+
32
+
33
+ // Use this for initialization
34
+
35
+ void Start()
36
+
37
+ {
38
+
39
+ this.mesh = new Mesh();
40
+
41
+ this.GetComponent<MeshFilter>().mesh = this.mesh;
42
+
43
+
44
+
45
+ // メッシュ作成
46
+
47
+ this.mesh.vertices = new Vector3[3]
48
+
49
+ {
50
+
51
+ new Vector3(-10, 0, 0),
52
+
53
+ new Vector3(0, 10, 0),
54
+
55
+ new Vector3(10, 0, 0),
56
+
57
+ };
58
+
59
+ this.mesh.SetIndices(new int[3] { 0, 1, 2 }, MeshTopology.Triangles, 0);
60
+
61
+
62
+
63
+ // 頂点データより法線を再計算する
64
+
65
+ this.mesh.RecalculateNormals();
66
+
67
+ }
68
+
69
+
70
+
71
+ // Update is called once per frame
72
+
73
+ void Update()
74
+
75
+ {
76
+
77
+
78
+
79
+ }
80
+
81
+ }
82
+
83
+ ```
84
+
85
+ このスクリプトを原点にあるGameObjectにでも登録して
86
+
87
+ カメラを(0, 1, -10)から原点映るようにして表示までは出来るかと