Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

useCamera

useCamera(cameraRigOptions?): object

The rig the camera hangs on: it registers the mounted orbit with what it follows, so the loop aims it, and hands back the props drei’s controls take, the engine’s bindings and bounds among them, on controls that keep the wall clock. A game with controls of its own spreads them the same way.

Parameter Type
cameraRigOptions CameraRigOptions

object

Name Type Default value
impl typeof CameraControls -
mouseButtons object -
mouseButtons.left 1 CameraControls.ACTION.ROTATE
mouseButtons.middle 16 CameraControls.ACTION.DOLLY
mouseButtons.right 0 CameraControls.ACTION.NONE
mouseButtons.wheel 16 CameraControls.ACTION.DOLLY
ref Dispatch<SetStateAction<CameraControls | null>> setOrbit
touches object -
touches.one 64 CameraControls.ACTION.TOUCH_ROTATE
touches.three 0 CameraControls.ACTION.NONE
touches.two 1024 CameraControls.ACTION.TOUCH_DOLLY