Skip to content

Commit 9eea980

Browse files
committed
docs: update README.md
add section for controlling Raycasting with pointerEvents-prop
1 parent 7071be0 commit 9eea980

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- [useFrame](#useframe)
2424
- [useLoader](#useloader)
2525
8. [Event Handling](#event-handling)
26+
- [Controlling Raycasting with pointerEvents](#controlling-raycasting-with-pointerevents)
2627
- [Supported Events](#supported-events)
2728
- [Event Object](#event-object)
2829
- [Event Propagation](#event-propagation)
@@ -230,6 +231,7 @@ const AdvancedProps = () => {
230231

231232
These patterns automatically trigger `needsUpdate` flags on materials and geometries when necessary.
232233

234+
233235
### Portal
234236

235237
The `Portal` component allows you to place children outside the regular scene graph while maintaining reactive updates. This is useful for rendering objects into different scenes or bypassing the normal parent-child relationships.
@@ -450,6 +452,24 @@ export const App = () => {
450452

451453
`solid-three` provides a comprehensive event system that integrates `three.js` pointer and mouse events with `solid-js`' reactivity. Events are automatically handled through raycasting and support stopping propagation.
452454

455+
### Controlling Raycasting with pointerEvents
456+
457+
The `pointerEvents` prop controls whether an Object3D can be targeted by raycasting:
458+
459+
- **pointerEvents** (`boolean`): When set to `false`, the object will not be hit by rays, but can still receive events through propagation from its descendants. Default is `true`.
460+
461+
```tsx
462+
// Object won't be hit by rays but children can still be interactive
463+
<T.Group pointerEvents={false}>
464+
<T.Mesh onClick={() => console.log("Child clicked!")}>
465+
<T.BoxGeometry />
466+
<T.MeshBasicMaterial />
467+
</T.Mesh>
468+
</T.Group>
469+
```
470+
471+
This is useful for creating invisible containers or optimizing performance by excluding objects from raycasting calculations.
472+
453473
### Supported Events
454474

455475
- `onClick` - Fired when clicking on an object

0 commit comments

Comments
 (0)