Skip to content

Commit

Permalink
docs: Adds paragraph on using a custom camera with controls
Browse files Browse the repository at this point in the history
  • Loading branch information
gsimone committed Mar 6, 2021
1 parent 604318d commit 56a170c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,19 @@ If available controls have damping enabled by default, they manage their own upd

Drei currently exports OrbitControls [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/controls-orbitcontrols--orbit-controls-story), MapControls [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/controls-mapcontrols--map-controls-scene-st), TrackballControls, FlyControls, DeviceOrientationControls, TransformControls [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/controls-transformcontrols--transform-controls-story), PointerLockControls [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/controls-pointerlockcontrols--pointer-lock-controls-scene-st)

Every control component can be used with a custom camera using the `camera` prop:

```jsx
const myCamera = useResource()

return (
<>
<PerspectiveCamera ref={myCamera} position={[0, 5, 5]} />
<OrbitControls camera={myCamera.current} />
</>
)
```

PointerLockControls additionally supports a `selector` prop, which enables the binding of `click` event handlers for control activation to other elements than `document` (e.g. a 'Click here to play' button).

# Shapes
Expand Down

0 comments on commit 56a170c

Please sign in to comment.