I'm currently creating a mesh in three.js using the following:
sphereGeometry = new THREE.SphereGeometry( 1, 16,16 );
mesh = new THREE.Mesh( sphereGeometry, material );
I've also created a torus:
torusGeometry = new THREE.TorusGeometry( 1, 0.42 );
At any point in my animation loop, I want to be able to swap the sphere out for the torus. Is this possible? How do I swap one geometry for another?
in Three.js R59, setGeometry and setMaterial were removed again from Three.Mesh
What you can do to replace geometry is removing your Mesh from Scene and creating a new one with your new geometry and your old material and add it back to your scene. This will work for sure :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With