Class ScenePicking

The ScenePicking class exposes high-level functionality for convenient picking and drag-selecting of objects in a camera viewport.

Hierarchy

  • FrameworkObject
    • ScenePicking

Constructors

  • Creates a new scene selection manager.

    Parameters

    • camera: Camera

      Camera into which to render the selection overlay, and perform picking from.

    • gizmoDrawSettings: GizmoDrawSettings

      Settings that control how are pickable gizmos drawn.

    • OptionalisInternalConstructor: boolean

    Returns ScenePicking

Accessors

Methods

  • Begin a drag selection, internally this records the selection when the drag operation starts.

    Parameters

    • initialSelection: SceneObject[]

      The initial selection to start the drag selection with.

    • updateSceneCache: boolean

      True to perform an update of the scene cache, required in most cases.

    • isCacheUpdateBlocking: boolean

      True to perform the update of the scene cache in a blocking manner, this is required when picking begins immediately.

    Returns void

  • End a drag selection, clears internal state set by BeginDragSelection.

    Returns void

  • Try to get cached object data at given location.

    Parameters

    • pointerPosition: Immutable<Vector2>

      Pointer position relative to the camera viewport, in pixels.

    • isBlockingCall: boolean

      Perform blocking readback of object MeshData.

    Returns ScenePickInformation

    Information about the scene picking

  • Try to get cached scene object data at given location.

    Parameters

    • pointerPosition: Immutable<Vector2>

      Pointer position relative to the camera viewport, in pixels.

    • isBlockingCall: boolean

      Perform blocking readback of object MeshData.

    Returns ScenePickInformation

    Information about the scene picking

    The SnapData might not be valid unless the data is already cached. If SnapData is required use getCachedSampleForPosition instead.

  • Get all intersection points between a line and the meshes of a scene object.

    Parameters

    Returns Intersection[]

    All the intersections between the line and the object, if any.

  • Attempts to acquire pick data for the provided pointerPosition.

    Parameters

    • pointerPosition: Immutable<Vector2>

      Position of the pointer relative to the scene camera viewport.

    • ignoreSceneObjects: SceneObject[]

      Optional set of objects to ignore during scene picking.

    Returns ScenePickInformation

    Information about the the snap.

    This is a slow API that should only be used for single-shot request. For continous requests, it's better to call updateCacheAsync and use getCachedSampleForPosition instead.

  • Attempts to select a scene object under the pointer position.

    Parameters

    • pointerPos: Immutable<Vector2>

      Position of the pointer relative to the scene camera viewport.

    • isAdditive: boolean

      Should this selection add to the existing selection, or replace it.

    • ignoreSceneObjects: SceneObject[]

      Optional set of objects to ignore during scene picking.

    Returns SceneObject

    This is a slow API that should only be used for single-shot request. For continous requests, it's better to call updateCacheAsync and use getCachedSampleForPosition instead.

  • Selects a scene object in the specified area. Rebuilds selection cache if needed.

    Parameters

    • pointerPos: Immutable<Vector2>

      Position of the pointer relative to the scene camera viewport.

    • area: Immutable<Vector2>

      Size of the in which objects will be selected, in pixels and relative to

    • isAdditive: boolean

      Should this selection add and remove to the existing selection, or replace it.

    • addOnly: boolean

      Should this selection only add to the existing selection, when additive is true.

    • ignoreSceneObjects: SceneObject[]

      Optional set of objects to ignore during scene picking.

    • blockingCall: boolean

      Is the function blocking until the results are available.

    Returns SceneObject[]

  • Schedules a update of cache containing object IDs and positions in given camera view.

    Parameters

    • ignoreSceneObjects: SceneObject[]

      A list of objects that should be ignored during scene picking.

    • OptionalisBlockingCall: boolean

      Should it wait for the mesh data to be read.

    • OptionaldrawGizmos: boolean

      Should gizmos be included.

    • OptionalintersectionRay: Immutable<Ray>

    Returns void

  • Schedules a update of cache containing object IDs and positions in given camera view.

    Parameters

    Returns void