ignore PointerEvents on hidden (visible={false}
) meshes
#2417
-
Hi, I'm using gltfjsx to import objects into my scene. The user can highlight them by mouseover. I'm using the I already tried to ignore meshes with I guess what I need is to "penetrate" invisible elements and only handle visible ones. Is this doable with r3f's pointer events? I prepared a minimalistic example: https://codesandbox.io/s/peaceful-brattain-kp075n?file=/src/App.js Ideally I don't want to manipulate the gltfjsx auto-generated files, because they will get constantly changed and regenerated by another 3D artist. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
It’s weird but that’s generally how three works. THREE.RayCaster is at fault here. In fiber it's an easy fix because you can change the the event filter. <Canvas onCreated={(state) => {
state.setEvents({ filter: (intersections) => intersections.filter(i => i.object.visible) }) |
Beta Was this translation helpful? Give feedback.
-
Would anyone know if there is a way to achieve something similar to this but for older versions of R3F, version 7.0.29 to be exact? I created an example using the versions I have set up with the project I'm currently working on: https://codesandbox.io/s/compassionate-architecture-lowlv4?file=/src/App.tsx |
Beta Was this translation helpful? Give feedback.
It’s weird but that’s generally how three works. THREE.RayCaster is at fault here. In fiber it's an easy fix because you can change the the event filter.