采摘json和射线

时间:2012-09-21 14:39:58

标签: three.js

对不起英语。如何访问加载Json的模型的网格来选择?我需要访问模型的部分并绘制部件 是鼠标结束了。 我使用下面的代码:

var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );

        var intersects = ray.intersectScene( scene );


        if (intersects.length) {

            if ( INTERSECTED != intersects.mesh ) {

                if ( INTERSECTED ) INTERSECTED.material.color.setHex( INTERSECTED.currentHex );

                INTERSECTED = intersects.mesh;
                INTERSECTED.currentHex = INTERSECTED.material.color.getHex();
                INTERSECTED.material.color.setHex( 0xff0000 );  
                INTERSECTED = mesh.geometry.material;
            }

        } else {

            if ( INTERSECTED ) INTERSECTED.material.color.setHex( INTERSECTED.currentHex );

            INTERSECTED = mesh.geometry.material;

        }


        webglRenderer.render( scene, camera );

0 个答案:

没有答案