Spawn
The spawn() function lets you spawn arbitrary THREE.js objects into the scene.
Additionally, if the object was spawned inside the update() loop, it will be automatically
removed from the scene when the next frame starts.
const geometry = new THREE.TorusKnotGeometry( 64, 16, 128, 16 ); const material = new THREE.MeshStandardMaterial(); const mesh = new THREE.Mesh(geometry, material); spawn(mesh);
Use the remove() function to remove objects from the
scene.