Reputation: 3
I tried to add a Points Object and a Mesh Object into the same scene. But once I add the Mesh the Points disappear. When I remove the Mesh the Points appear again. Is it possible with three.js to have both in the scene at the same time? I'm using r76 now. It worked before with Three.ParticleSystem in threejs r63. Is this a bug or missed I something conceptual between r63 and r76?
Same behaviour seems to be with Three.Line and Three.Points which I can't render together either.
Any ideas about that? Thank you in advance.
Upvotes: 0
Views: 2271
Reputation: 1410
Well, I'll bite (you don't have any code) -- what's wrong with
// - - - - points
geometry = new THREE.Geometry();
material = new THREE.PointsMaterial( { size:.1 } );
for (i1=1; i1<=10; i1+=1) {
var x1 = Math.random()*2-1;
var y1 = Math.random()*2-1;
var z1 = Math.random()*2-1;
geometry.vertices.push(new THREE.Vector3(x1,y1,z1));
}
object3d = new THREE.Points(geometry, material);
scene.add(object3d);
// - - - - line
geometry = new THREE.Geometry();
geometry.vertices = [ new THREE.Vector3(-1,1,0), new THREE.Vector3(0,-1,0), new THREE.Vector3(1,1,0) ];
material = new THREE.LineBasicMaterial( { color:0xffffff } );
object3d = new THREE.Line(geometry, material);
scene.add(object3d);
// - - - - sphere
geometry = new THREE.SphereGeometry(.5);
material = new THREE.MeshPhongMaterial( {color:0xffffff} );
mesh = new THREE.Mesh(geometry, material);
mesh.scale.x = 2;
mesh.position.set(0, 1, 0);
scene.add(mesh);
Upvotes: 1