我试图添加一个系统粒子,一个THREE.Points到场景,但我有这个错误:
" THREE.Object3D.add:object不是THREE.Object3D的实例。未定义"
代码:
var backCount = 1800;
var particlesG = new THREE.Geometry();
for (var p = 0; p < backCount; p++) {
var backgroundP = new THREE.Vector3();
backgroundP.x = Math.random() * 3000 - 1500;
backgroundP.y = Math.random() * 3000 - 1500;
backgroundP.z = Math.random() * 3000 - 1500;
particlesG.vertices.push(backgroundP);
}
var pMaterial = new THREE.PointsMaterial({color: 0xFFFFFF});
var particleSystemS = THREE.Points(particlesG, pMaterial);
scene.add(particleSystemS);
由于
答案 0 :(得分:2)
在THREE.Points
之前添加新内容。
var particleSystemS = new THREE.Points(particlesG, pMaterial);