前提・実現したいこと
あらかじめ用意した配列からx座標とy座標(z座標は0で固定)を計算し、3次元上に点オブジェクトを打つことを考えています。
しかし以下のようなエラーが発生していて、よくわかりません。
何がundefinedかnullになっているのでしょうか。
書き方で何かミスがありますでしょうか。
解決策がありましたらコメントお願いします。
発生している問題・エラーメッセージ
three.min.js:672 Uncaught (in promise) TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>) at ac.updateMorphTargets (three.min.js:672) at new ac (three.min.js:216) at new l.ParticleSystem (three.min.js:980) at init ((index):97)
該当のソースコード
disとrotには想定している値が入っています。
//形状オブジェクトの宣言と生成 var geometry= new THREE.Geometry(); for(var i=0;i<2000;i++){ var x=(dis[i] * Math.cos( rot[i] * (Math.PI / 180) ))/2; var y=(dis[i] * Math.sin( rot[i] * (Math.PI / 180) ))/2; //alert(x); //alert(y); //geometry.vertices[i]= new THREE.Vector3(x,0,y); geometry.vertices.push(new THREE.Vector3(x,0,y)); } //材質オブジェクトの宣言と生成 var material=new THREE.ParticleBasicMaterial({color: 0xFF0000, size: 10.0}); //点オブジェクトの生成 var particles = new THREE.ParticleSystem(geometry,material); //点オブジェクトのシーンへの追加 scene.add(particles);
あなたの回答
tips
プレビュー