1

对不起英语。如何访问加载了 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 );
4

0 回答 0