2

我使用网格来添加对象,然后我将网格添加到场景中。现在我想从网格中访问对象,以便我可以在相应的网格中执行旋转对象及其子对象。

示例代码,但建议查找 jsfiddle 链接以获取详细知识:http: //jsfiddle.net/sagh0900/PrVbg/3/

mesh = new THREE.Mesh(new THREE.Geometry());
scene.add(mesh);

renderer = new THREE.WebGLRenderer();

renderer.setClearColorHex(0xffffff, 1);
renderer.setSize( width, height );


for ( var i = 0; i <nSize; i++)
{
    var k = i%10,
        j = (i-k)/10;

    j = j*2 - 10;
    k = k*2 - 10;

    cone1 = lc_relationship.sensor1[i].Geometry; 
    mesh.add(cone1);
    cone2 = lc_relationship.sensor2[i].Geometry;
    mesh.add(cone2);
    cone3 = lc_relationship.sensor3[i].Geometry;
    mesh.add(cone3);
    cone1.position.set(j, k, lc_relationship.sensor1[i].z_cordinate);
    cone2.position.set(j, k, lc_relationship.sensor2[i].z_cordinate);
    cone3.position.set(j, k, lc_relationship.sensor3[i].z_cordinate);
}

在此处输入图像描述

提前致谢

4

0 回答 0