对不起我的英语:我加载了几个对象。Json 和我使用 Ray 选择它们并相交以使它们改变颜色。但我想知道在运行时选择了哪个加载的对象。当前并使用下面的代码,输出为: [object Object] $ var intersects = ray.intersectObjects(scene.children);
if ( intersects.length > 0 ) {
if ( INTERSECTED != intersects[ 0 ].object ) {
var aux = intersects[ 0 ].object;
if ( INTERSECTED ) INTERSECTED.material.emissive.setHex( INTERSECTED.currentHex );
INTERSECTED = intersects[ 0 ].object;
INTERSECTED.currentHex = INTERSECTED.material.emissive.getHex();
INTERSECTED.material.emissive.setHex( 0xffff00 );
console.debug("name:,"+aux);
}
} else {
if ( INTERSECTED ) INTERSECTED.material.emissive.setHex( INTERSECTED.currentHex );
INTERSECTED = null;
}