2
在我的场景中,有很多对象组(Object3Ds),并且我已经设置了一个系统来点击/悬停在它们上面来做某些事情。当它使用raycaster来查找鼠标下的哪些对象时,它将返回单个对象,而不是组(我需要)。Three.js从它的孩子获取父对象(一组)
我用来获取光标下的对象代码看起来像这样:
raycaster.setFromCamera(mouse, camera);
clickobjstore = raycaster.intersectObjects(objects, true);
// The following doesn't work because intersects[0] is not the group, it's the object within the group!
for (j = 0; j < intersects[0].object.children.length; j++) {
intersects[0].object.children[j].material.color.setHex(0x1A75FF);
}
谢谢!我应该猜到了,因为它很简单:) – MrGarretto