0

i'm trying to add a system particles, a THREE.Points to the scene, but i have this error:

"THREE.Object3D.add: object not an instance of THREE.Object3D. undefined"

The code:

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);

Thanks

1
  • 1
    don't you need a "new" keyword for points, too? Commented Dec 17, 2017 at 11:46

1 Answer 1

2

Add new before THREE.Points.

var particleSystemS = new THREE.Points(particlesG, pMaterial);

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.