0
所以我有兩個盒子的幾何形狀:three.js所,組旋轉
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);
他們兩人爲一組被轉圈:
group.rotation.y += ctrl.groupStep;
所以我們可以說,我希望他們繼續像這樣旋轉,因爲同一組中有更多不同的對象,但我也希望這兩個框幾何在旋轉時旋轉。 於是,我就這條線旁添加group.rotation:
box.rotation.z += 0.02;
但是隻有一個框旋轉。
如何使它們都旋轉?