Skip to content Skip to sidebar Skip to footer

Add Multiple Spheres In A Three.js Scene

This is my first week dabbling in javascript and my 3d day with three.js so please bear with me, this may be possibly a dumb question. My problem is this: I have created a scene, i

Solution 1:

Try updating the following code block:

jointSpheres[j].position.x = joint1.position.x[j];
jointSpheres[j].position.y = joint1.position.y[j];
jointSpheres[j].position.z = joint1.position.z[j];

To:

jointSpheres[j].position.x = joint1.position.x;
jointSpheres[j].position.y = joint1.position.y;
jointSpheres[j].position.z = joint1.position.z;

Also your jointspheres will break if you have more than 1 skeleton (they will be overwritten in next pass). Maybe you should do

jointspheres[i][j] = new THREE.Mesh(sphereGeometry, sphereMaterial);

And so on...

Post a Comment for "Add Multiple Spheres In A Three.js Scene"