makeOrbitController()
An orbit camera over an input: turntable, look-around room or pan-only map, depending on rotate and pan. Desktop: primary drag rotates, right/middle or shift+drag pans (with pan: "secondary"), wheel and ctrl+wheel zoom. Touch: one finger rotates, two pinch to zoom and drag to pan (or to turn,...
function makeOrbitController(input: Input, opts?: OrbitOptions): OrbitController;Defined in: engine/src/input/orbit.ts:102
An orbit camera over an input: turntable, look-around room or pan-only map, depending on
rotate and pan. Desktop: primary drag rotates, right/middle or shift+drag pans (with
pan: "secondary"), wheel and ctrl+wheel zoom. Touch: one finger rotates, two pinch to zoom
and drag to pan (or to turn, when panning is off). Long-press is off in its recogniser.
The controller only holds state; read it each frame into the renderer's makeCamera.
Parameters
| Parameter | Type | Description |
|---|---|---|
input | Input | The surface's input. |
opts? | OrbitOptions | - |
Returns
The camera state and controls.
Example
const camera = makeCamera({ target: [48, 8, 48], distance: 200, pitchDeg: 32, fovDeg: 35 });
const orbit = makeOrbitController(input, {
yaw: 35, pitch: 32, distance: 200, distanceLimits: [40, 600],
target: [48, 8, 48], pan: "secondary", fovDeg: 35, onChange: () => loop.invalidate(),
});
renderer.render({ ...camera(orbit.yaw(), orbit.distance(), orbit.target(), orbit.pitch()) });makeLookController()
First-person look from mouse (pointer lock after a click, or drag without it), touch drag, the right stick and optional turn keys. Movement is gathered as events arrive and applied in update(dt), so stick and key speed is framerate-independent and the mouse is counted once.
makeTouchControls()
Add on-screen joysticks and buttons that feed the input's virtual channel, so a game binds touch:move.x beside key:KeyA and pad:LeftX. The controls are a fixed overlay of their own elements, so fingers on them never reach the canvas gestures. DOM-only.