You keep overwriting your cube in the loop. Use an array and you can address each cube via the index.
var cube = [];
...
for (let i = 0; i < 3; i++) {
cube[i] = new THREE.Mesh(geometry, material);
cube[i].position.x = i;
scene.add(cube[i]);
}
...
function render() {
cube[0].rotation.x += 0.01;
cube[0].rotation.y += 0.01;
// use other indexes....
renderer.render(scene, camera);
}
Check this out too:
https://hofk.de/main/discourse.threejs/2019/Carousel/Carousel.html
from