gpt4 book ai didi

javascript - 添加一个 THREE.Points 到场景 : THREE. Object3D.add : object not an instance of THREE. Object3D (Javascript)

转载 作者:行者123 更新时间:2023-12-01 02:36:40 32 4
gpt4 key购买 nike

我正在尝试添加一个系统粒子,一个三点到场景,但我有这个错误:

“THREE.Object3D.add:对象不是 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);

谢谢

最佳答案

THREE.Points之前添加新内容。

var molecularSystemS = new THREE.Points(articlesG, pMaterial);

关于javascript - 添加一个 THREE.Points 到场景 : THREE. Object3D.add : object not an instance of THREE. Object3D (Javascript),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47854754/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com