添加两个立方体进行分组,并将它们分成三个.js

时间:2018-01-13 01:49:18

标签: three.js

我试图将两个立方体添加到同一个组中并使它们相邻渲染。

var cube1 = new THREE.Mesh(new THREE.CubeGeometry(1,1,1), new THREE.MeshNormalMaterial());  
var cube2 = new THREE.Mesh(new THREE.CubeGeometry(1,1,1), new THREE.MeshNormalMaterial());

cube1.position = new THREE.Vector3( 1, 0 , 0 );
cube2.position = new THREE.Vector3( 0, 1 , 0 );

var cubeGroup = new THREE.Group();  

cubeGroup.add( cube1 );
cubeGroup.add( cube2 );

scene.add(cubeGroup);

输出似乎在同一位置显示两个立方体。

enter image description here

我在初始化期间通过沿正交组件拉伸它们来检查那些是两个不同的立方体...

var cube1 = new THREE.Mesh(new THREE.CubeGeometry(2,1,1), new THREE.MeshNormalMaterial());  
var cube2 = new THREE.Mesh(new THREE.CubeGeometry(1,2,1), new THREE.MeshNormalMaterial());

结果是两个矩形棱镜沿着原点渲染/居中:

enter image description here

所以我的问题如下:

  • 一般来说,whats wrong and how do I make it work?
  • 就群组而言,are groups used to compose meshes into single units?(I want to rotate many adjacent cubes along a central axis)
  • 以比例表示Do CubeGeometries operate on the same scale that vectors and positions operate on?

0 个答案:

没有答案