glodrei
Version:
useful add-ons for react-three-fiber
19 lines (14 loc) • 511 B
text/mdx
title: useCamera
sourcecode: src/core/useCamera.tsx
[](https://drei.vercel.app/?path=/story/misc-usecamera--use-camera-st)
<Grid cols={4}>
<li>
<Codesandbox id="py4db" />
</li>
</Grid>
A hook for the rare case when you are using non-default cameras for heads-up-displays or portals, and you need events/raytracing to function properly (raycasting uses the default camera otherwise).
```jsx
<mesh raycast={useCamera(customCamera)} />
```