@vulfram/camera-control
v0.21.1-alpha
Published
Standard camera controllers for `@vulfram/engine`.
Readme
@vulfram/camera-control
Standard camera controllers for @vulfram/engine.
Included Controllers
createOrbitControllercreateSpectatorControllercreateFirstPersonController(cinematic, without physics/collision)createThirdPersonControllercreateTopViewController
Core Behavior
- Pointer input is internally coupled for all controllers.
- Current pointer gesture model is mouse-based (
left/middle/right). - Every controller config accepts
pointerDeltaSensitivity(1default) to scale pointer-driven rotation/look speed. - Every controller config accepts
invertPointerX/invertPointerY(falseby default) to invert pointer axis response. Orbit,ThirdPerson, andTopViewacceptzoomSensitivity(1default) to scale zoom response (pointer gesture andtoZoom()impulse).translationStrategyandeasingare optional in every controller config.- Without
translationStrategy/easing, movement is linear. - All controllers support
lookAt(position, weight?).- Negative weight rotates by the longest arc.
Orbitgesture split:- rotate: right button or left button (without middle button)
- pan: middle button (without right button)
Orbitsupports enable/disable flow:enable()disable()setEnabled(boolean)isEnabled()
TopViewsupports focus lock:focusLocked(config)setFocusLocked(boolean)isFocusLocked()
Motion Actions (Spectator / FirstPerson)
Use weighted triggers (1.0 default):
controller.pressForward(); // persistent while pressed
controller.releaseForward();
controller.toForward(2.0); // one-frame impulse
controller.look(3, -2, 1.5); // weighted look deltaNegative weights are accepted:
controller.toForward(-1.0); // opposite direction
controller.lookAt([0, 1, 0], -1); // longest-arc look rotation