So I have two box geometries:
var box;
loader.load( 'img/plytos.jpg', function ( texture ){
var boxGeometry = new THREE.BoxGeometry(7,0.5,0.5);
var boxMaterial = new THREE.MeshLambertMaterial({ map: texture, overdraw: 0.5 });
box = new THREE.Mesh(boxGeometry, boxMaterial);
box.castShadow = true;
box.position.x=15;
box.position.y=5;
box.position.z=2.7;
group.add(box);
var box;
loader.load( 'img/plytos.jpg', function ( texture ){
var boxGeometry = new THREE.BoxGeometry(7,7,0.5);
var boxMaterial = new THREE.MeshLambertMaterial({ map: texture, overdraw: 0.5 });
box = new THREE.Mesh(boxGeometry, boxMaterial);
box.castShadow = true;
box.position.x=15;
box.position.y=5;
box.position.z=2.7;
group.add(box);
Both of them are in one group which is spinning around:
group.rotation.y += ctrl.groupStep;
So let's say I want them to keep spinning like this, because there are more different objects in a same group, but I also would like these two box geometries to rotate while they're spinning. So I tried to add this line next to group.rotation:
box.rotation.z += 0.02;
However only one box is rotating.
How to make both of them rotate?