is there a container type object in three.js to transform a group of children?

前端 未结 1 593
再見小時候
再見小時候 2021-02-07 12:43

is there a container or node object in three.js in which multiple meshes can be added as child so that they can be transformed together?

(an invisible container that all

相关标签:
1条回答
  • 2021-02-07 13:25

    Example.

    var group = new THREE.Group();
    
    for ( var i = 0; i < 1000; i ++ ) {
    
        var mesh = new THREE.Mesh( geometry, material );
        mesh.position.x = Math.random() * 2000 - 1000;
        mesh.position.y = Math.random() * 2000 - 1000;
        mesh.position.z = Math.random() * 2000 - 1000;
    
        mesh.rotation.x = Math.random() * 360 * ( Math.PI / 180 );
        mesh.rotation.y = Math.random() * 360 * ( Math.PI / 180 );
    
        group.add( mesh );
    
    }
    
    scene.add( group );
    

    r69+

    0 讨论(0)
提交回复
热议问题