質問編集履歴

1

console.logの結果を追加しました。

2017/11/10 04:01

投稿

sakuramoti
sakuramoti

スコア20

test CHANGED
File without changes
test CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  カメラや光源のinit()は省きます。
26
26
 
27
-
27
+ ```
28
28
 
29
29
  var g_mesh;
30
30
 
@@ -40,17 +40,11 @@
40
40
 
41
41
  Mesh = function(scene) {
42
42
 
43
-
44
-
45
43
  var manager = new THREE.LoadingManager();
46
44
 
47
45
  manager.onProgress = function ( item, loaded, total ) {
48
46
 
49
-
50
-
51
- console.log( item, loaded, total );
47
+ console.log( item, loaded, total );
52
-
53
-
54
48
 
55
49
  };
56
50
 
@@ -100,13 +94,15 @@
100
94
 
101
95
  mesh.receiveShadow = true;
102
96
 
97
+ mesh.position.set(0,0,0);
98
+
99
+ //console.log(mesh.position.x); 0と表示される。
100
+
103
101
  scene.add(mesh);
104
102
 
105
103
  }, onProgress, onError);
106
104
 
107
-
105
+ //console.log(mesh.position.x);Uncaught TypeError: Cannot read property 'position' of undefinedと表示され、画面に何も表示されなくなってしまう。
108
-
109
-
110
106
 
111
107
  }
112
108
 
@@ -124,6 +120,8 @@
124
120
 
125
121
  function animate() {
126
122
 
123
+ // console.log(g_mesh.mesh);undefined と表示される。
124
+
127
125
  requestAnimationFrame(animate);
128
126
 
129
127
  g_renderer.render(g_scene, g_camera);