在three.js中有一个容器类型对象来转换一组孩子吗? [英] is there a container type object in three.js to transform a group of children?

查看:104
本文介绍了在three.js中有一个容器类型对象来转换一组孩子吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在three.js中是否有一个容器或节点对象,其中可以将多个网格添加为子节点以便它们可以一起转换?

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?)

谢谢

推荐答案

示例

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 +

这篇关于在three.js中有一个容器类型对象来转换一组孩子吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆