Interactive transform gizmo for a View.

Attaches to a SceneObject, SceneMesh, or matrix adapter, and lets the user translate, rotate, or scale the target through axis arrows, plane handles, rotation rings, and a view-aligned trackball.

The rig is built into a dedicated ViewLayer and SceneModel created in the supplied view's scene, so it does not interfere with the host scene's objects or visibility state. Handles render through an overlay bin (depth-cleared, depth-test always-pass) so they float over host geometry regardless of where the target sits in world space.

setSpace("world") aligns the handles with the world axes; setSpace("local") aligns them with the target's current rotation.

setSize sets a target screen-space size in pixels. The controls recompute world-space scale on every camera change so the rig stays a constant pixel size regardless of camera distance.

setTranslationSnap, setRotationSnap, and setScaleSnap quantise drag deltas; pass null to disable.

Subscribe to TransformControls.events for onDragStart, onDragEnd, onChange, and onObjectChange. See TransformControlsEvents.

Drag interaction requires a PickStrategy, supplied via TransformControlsParams.picker. Without one the handles render but cannot be grabbed.

Constructors

Properties

dragAxis: TransformControlsAxis = null

The axis of the handle currently being dragged, or null when no drag is in progress.

dragging: boolean = false

true while a drag is in progress (between onDragStart and onDragEnd).

Typed event emitters fired by this gizmo. See TransformControlsEvents.

hoveredAxis: TransformControlsAxis = null

The axis of the handle currently under the pointer, or null when no handle is hovered. Updated by the pointer-move handler before onChange fires.

id: string

Unique id used as the ViewLayer and SceneModel id.

sceneModel: SceneModel

Dedicated SceneModel that holds the gizmo's handle, picker, and helper meshes. Created during construction and destroyed by destroy.

view: View

The View this gizmo lives in.

viewLayer: ViewLayer

Dedicated ViewLayer that hosts the gizmo handle ViewObjects. Created during construction and destroyed by destroy.

Accessors

  • get dragPivot(): Vec3

    World-space pivot snapshot taken at the most recent pointerdown — read-only window onto the internal _dragPivot. Read this from devtools mid-drag to verify the rotate / scale origin matches the surface point you picked. Returns the same reference each call (do not mutate).

    Returns Vec3

  • get isExplicitPivot(): boolean

    true when the gizmo's pivot came from an explicit pivotWorld option on attach, false when it fell back to the target's primary world-matrix translation. If you supplied a pivot but this reads false, your attach-time options chain dropped it somewhere.

    Returns boolean

Methods

  • Attaches a target.

    Accepts a SceneObject (every mesh of which transforms as a rigid group), a SceneMesh, or a getMatrix / setMatrix adapter.

    The gizmo's pivot — the rotation centre, scale origin, and the world-space anchor the handles render around — is set from options.pivotWorld when supplied (use the world position returned by your picker so the gizmo appears exactly at the surface point the user clicked). When omitted, the pivot falls back to the target's primary world-matrix translation.

    Translation drags move the pivot with the object; rotate and scale drags hold the pivot fixed as the operation's centre, which is what makes "rotate this object about the point I clicked" feel correct.

    Fires onChange after the rig has been re-posed.

    Parameters

    Returns void

  • Toggles verbose console logging during attach, pointerdown, and every drag transform.

    Each log line is prefixed [TransformControls <id>] and carries enough state to verify the pivot / drag-pivot / per-mesh translation behaviour without poking at private fields:

    • attach — the resolved pivotWorld, whether it was explicit, and the target type.
    • pointerdown — the picked handle id, the snapshotted drag pivot, and the per-mesh start-world translation columns.
    • rotate / scale / translate — the operation type, axis and angle (or factors), the pivot used, and per-mesh translation deltas (start → new) so a mesh that fails to move shows up immediately.

    Switch on from the host (or from a devtools console on a captured reference: transformControls.setDebug(true)) when chasing pivot drift, snapshot mismatch, or mid-drag detach issues.

    Parameters

    • v: boolean

    Returns void

  • Enables or disables pointer interaction with the gizmo.

    When disabled the handles still render but do not respond to hover or drag input. Useful for guarding the controls during a transient host-app interaction (for example a modal dialog).

    Parameters

    • v: boolean

      true to enable interaction, false to disable.

    Returns void

  • Sets the gizmo's screen-space size in pixels.

    The handles render at approximately sizePx pixels on screen regardless of camera distance — the controls recompute the world-space scale on every camera change. Clamped to a minimum of 8 pixels.

    Fires onChange.

    Parameters

    • sizePx: number

      Target on-screen size in pixels.

    Returns void