scene.traverse(function(obj){
if(obj.type === 'GridHelper'){
obj.material.color = new THREE.Color(0, 1, 0);
}
if(obj.type === 'Mesh'){
obj.position.x = -5 + Math.floor(10 * Math.random());
obj.position.z = -5 + Math.floor(10 * Math.random());
obj.rotation.y = Math.PI * 2 * Math.random();
}
if(obj.type === 'Group'){
var len = obj.children.length;
obj.children.forEach(function(child, i){
child.position.y = -5 + Math.floor( 10 * (i / len) );
var s = 0.25 + 1.75 * (1 - i / len);
child.scale.set(s, s, s);
});
}
});
three.js 遍历模型
最新推荐文章于 2023-12-10 10:38:43 发布