Owns the picking infrastructure Studio used to carry inline: the BVH-backed SceneCollisionIndex and the unified PickStrategy (a memoising router over BVH + GPU paths).

Both members are lazily constructed on first access so that demos that never pick anything — converters, headless tests — don't pay for the BVH build or the renderer wiring.

Scene and Renderer are pulled through callback refs because Studio sets them in init(), not in the constructor. The PickingService itself can be constructed up-front; the underlying objects are built on demand once scene/renderer are populated.

Constructors

Accessors

  • get picker(): PickStrategy

    Unified pick strategy — a MemoisingPickStrategy wrapping a RoutingPickStrategy. The router decides BVH vs GPU snap per call (and tracks renderer attach / context loss via the routing strategy's observer); the memoiser caches the most recent result so identical back-to-back picks (e.g. a same-frame pointermove → ViewController hover + measurement hover both picking the same canvas pixel) skip the underlying work.

    Tolerance is 0 (exact match) so caching is strictly correctness-preserving; pass a MemoisingPickStrategy directly to anything that wants pixel-jitter slack.

    Returns PickStrategy

Methods

  • ViewController-shape pick adapter.

    Adapts the viewer-side PickParams/PickResult contract that ViewController and PickController expect onto the unified PickStrategy.pick interface. Snap fields (snapToVertex / snapToEdge) are forwarded so any ViewController consumer that asks for snap gets it via the routing strategy's GPU branch.

    Populates the fields PickController + the mouse handlers actually consume: viewObject, canvasPos, worldPos. Other fields stay unset, which the consumer treats as "not picked" for those facets (e.g. worldNormal is null → no surface-normal-aware behaviour).

    Use this as the pick callback when constructing a ViewController; for one-off canvas-position picks reach for picker directly.

    Parameters

    Returns SDKResult<viewing.viewer.PickResult>