API

Function pickAsync

  • Pick the mesh at CSS-space canvas coordinates, matching Babylon.js Scene.pick. Returns a PickingInfo.

    A picker's 1×1 readback targets (PickTargets1x1.colorStaging/depthStaging) are lazily created ONCE and reused for every pick — cheap, but it means two overlapping pickAsync calls on the SAME picker race mapAsync on those shared buffers ("Buffer already has an outstanding map pending", since a GPUBuffer allows only one pending map at a time). This is easy to trigger from a consumer: e.g. a cursor-following hover preview that GPU-picks on every pointermove, racing a pick fired by a click that lands before the hover's pick has unmapped. Queue concurrent calls per-picker instead of rejecting: each pick's full map/unmap cycle completes before the next one starts.

    Parameters

    Returns Promise<PickingInfo>