[英]Three.js: for loop for every mesh in scene?
所以我想做的就是做点什么
scene.forEachMeshInScene(function(mesh){
//And here I can do stuff
});
但遗憾的是,这不存在。 我怎么能这样做?
您可以使用以下模式迭代scene
图中的Mesh
对象:
scene.traverse( function( node ) {
if ( node instanceof THREE.Mesh ) {
// insert your code here, for example:
node.material = new THREE.MeshNormalMaterial()
}
} );
three.js r.69
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.