API

Class TargetCameraMovement

Shared movement system for TargetCamera and its subclasses (FreeCamera, FlyCamera, FollowCamera). Provides framerate-independent physics (via CameraMovement) and a declarative InputMapper for configuring which physical inputs trigger which interactions.

Accumulator mapping for this camera family:

  • translate feeds panAccumulatedPixels as a WORLD-space direction (input classes orient local intent into world space before populating it, mirroring the legacy cameraDirection surface).
  • rotate feeds rotationAccumulatedPixels (x=pitch, y=yaw), mirroring legacy cameraRotation.

These camera classes have no separate zoom channel: mouse-wheel input folds into translation/rotation just like the legacy inputs, so there is no zoom interaction here.

Input classes inject deltas using the same scaling they applied historically and the movement system leaves all speed multipliers at 1, so at the reference framerate the per-frame applied delta matches the legacy value exactly while inertial glide becomes framerate-independent.

Hierarchy (View Summary)

Index
activeInput: boolean = false

Should be set by input classes to indicate whether there is active input this frame. This helps differentiate between 0 pixel delta due to no input vs user actively holding still.

Input system that maps physical inputs to interactions and dispatches to handlers.

panAccumulatedPixels: Vector3 = ...

Accumulated pixel delta (by input classes) for panning this frame Read by computeCurrentFrameDeltas() function and converted into panDeltaCurrentFrame (taking speed into account) Reset to zero after each frame

panDeltaCurrentFrame: Vector3 = ...

Pan delta to apply to camera this frame, computed by computeCurrentFrameDeltas() from panPixelDelta (taking speed into account)

panInertia: number = 0.9

Inertia applied to the panning velocity when there is no user input. Higher inertia === slower decay, velocity retains more of its value each frame.

Note: ArcRotateCamera overrides this from camera.panningInertia (which defaults to camera.inertia).

panSpeed: number = 1

Desired coordinate unit movement per input pixel when panning

referenceFrameRate: number = DefaultReferenceFrameRate

Framerate (Hz) at which inertia values are calibrated. Default 60 matches legacy camera feel at any actual refresh rate. Override to 120, 144, etc. only if your app was tuned on that specific refresh rate under the legacy (framerate-dependent) camera math and you want to preserve that exact decay characteristic. Most applications should leave this at 60.

rotationAccumulatedPixels: Vector3 = ...

Accumulated pixel delta (by input classes) for rotation this frame Read by computeCurrentFrameDeltas() function and converted into rotationDeltaCurrentFrame (taking speed into account) Reset to zero after each frame

rotationDeltaCurrentFrame: Vector3 = ...

Rotation delta to apply to camera this frame, computed by computeCurrentFrameDeltas() from rotationPixelDelta (taking speed into account)

rotationInertia: number = 0.9

Inertia applied to the rotation velocity when there is no user input. Higher inertia === slower decay, velocity retains more of its value each frame.

Note: ArcRotateCamera syncs this from camera.inertia via an accessor on the camera class. To tune independently, override inside scene.onBeforeRenderObservable after camera.inertia is read.

rotationXSpeed: number = 1

Desired radians movement per input pixel when rotating along x axis

rotationYSpeed: number = 1

Desired radians movement per input pixel when rotating along y axis

speed: number = 1

Global speed multiplier applied to all movement (pan, rotation, zoom). Acts as a master scale factor on top of the individual speed properties.

zoomAccumulatedPixels: number = 0

Accumulated pixel delta (by input classes) for zoom this frame Read by computeCurrentFrameDeltas() function and converted into zoomDeltaCurrentFrame (taking speed into account) Reset to zero after each frame

zoomDeltaCurrentFrame: number = 0

Zoom delta to apply to camera this frame, computed by computeCurrentFrameDeltas() from zoomPixelDelta (taking speed into account)

zoomInertia: number = 0.9

Inertia applied to the zoom velocity when there is no user input. Higher inertia === slower decay, velocity retains more of its value each frame.

Note: ArcRotateCamera syncs this from camera.inertia via an accessor on the camera class. To tune independently, override inside scene.onBeforeRenderObservable after camera.inertia is read.

zoomSpeed: number = 1

Desired coordinate unit movement per input pixel when zooming

  • get isInterpolating(): boolean

    Returns true when the camera is playing an interpolating (fly-to) animation. Useful for suppressing user-input movement while a programmatic animation is active.

    Returns boolean

  • When called, will take the accumulated pixel deltas set by input classes and convert them into current frame deltas, stored in currentFrameMovementDelta properties Takes speed, scaling, inertia, and framerate into account to ensure smooth movement Zeros out pixelDeltas before returning

    Returns void

  • Returns the per-frame decay factor for a given inertia, adjusted to this frame's dt. At the reference frame rate, returns inertia unchanged (matches legacy per-frame *= inertia). Use this when implementing custom decaying accumulators (e.g. zoom-to-cursor coupled pan) that need framerate-independent glide duration.

    Parameters

    • inertia: number

      The inertia value (0-1) whose per-frame decay factor is needed.

    Returns number

    The decay factor to multiply a value by this frame.

  • Returns the input-scale factor to apply to an impulse injected into a decaying accumulator so that the integrated total is framerate-independent and matches legacy at 60fps. At the reference frame rate, returns 1 (no-op). At high fps, scales the impulse down so the sum over the decay tail stays equal to impulse / (1 - inertia) — the legacy total.

    Parameters

    • inertia: number

      The inertia value (0-1) used by the accumulator.

    Returns number

    The scaling factor to multiply an impulse by before adding it to the accumulator.