Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 allows to perform transformations on all child objects as in a group?)

thanks

like image 995
JayDee Avatar asked May 27 '12 19:05

JayDee


1 Answers

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+

like image 52
mrdoob Avatar answered Sep 29 '22 06:09

mrdoob



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!