API

Function setCameraLimits

  • Configure orbit/zoom limits on an ArcRotateCamera. This is fully opt-in and self-contained: cameras that never call it pay zero cost and bundle no clamping code (the camera's scalar setters call an undefined hook).

    What it does:

    1. Stores the provided bounds on the camera and clamps the current pose into range right away (inertia zeroed), so enabling limits never causes a jump.
    2. Installs a self-clamp hook on the camera (_clampToLimits). The alpha/beta/radius setters invoke it on every mutation, so any caller — pinch direct-write, inertial overshoot, auto-rotate — is snapped back to the wall in the same statement that pushed past it. The camera is therefore never observably out of bounds at any point a per-frame callback reads it (e.g. a camera-pinned skybox), eliminating both the overshoot-then-snap jiggle and the one-frame clip "blink" of a deferred per-frame clamp.

    Only the fields present on limits are written, so calls compose; pass a field as undefined to remove that bound. Returns a disposer that removes the self-clamp hook.

    The optional scene parameter is accepted for backward compatibility and is unused — enforcement no longer needs a per-frame scene hook.

    Parameters

    Returns () => void