voxolith

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

ParameterTypeDescription
inputInputThe surface's input.
opts?OrbitOptions-

Returns

OrbitController

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()) });

On this page