Vertex Viewer SDK
    Preparing search index...

    Class Raycaster

    The Raycaster class is here.

    Implements

    • RaycasterLike
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Performs request on the stream to find items that intersect the given point.

      Parameters

      • point: Point.Point

        The point to cast from looking for intersections.

      • Optionaloptions: RaycasterOptions

        Optional set of options for the request

      Returns Promise<IHitItemsResult | undefined>

      const viewer = document.querySelector("vertex-viewer");

      viewer.addEventListener("tap", async (event) => {
      const scene = await viewer.scene();
      const raycaster = scene.raycaster();

      // Query the scene for the item at the position of the `tap` event
      const [hit] = await raycaster.hitItems(event.detail.position);

      if (hit != null) {
      // If there was an item present at the position, select it
      await scene.elements((op) =>
      op.items.where((q) => q.withItemId(hit.itemId.hex)).select()
      );
      }
      });