Performs request on the stream to find items that intersect the given point.
The point to cast from looking for intersections.
Optionaloptions: RaycasterOptionsOptional set of options for the request
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()
);
}
});
The
Raycasterclass is here.