簡體   English   中英

單擊覆蓋場景中自定義幾何體上的偵聽器 - Autodesk forge 查看器

[英]Click listener on custom geometry in the overlay scene - Autodesk forge viewer

我在 Forge 查看器的 2D 屏幕上添加了自定義幾何圖形

     const geom = new THREE.SphereGeometry(10, 8, 8);
     const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });
     const sphereMesh = new THREE.Mesh(geom, material);
     sphereMesh.position.set(1, 2, 3);
     viewer.impl.createOverlayScene('custom-scene');
     viewer.impl.addOverlay('custom-scene', sphereMesh);
     viewer.impl.invalidate(true);

如何在此疊加場景的網格上添加點擊偵聽器。

TL;TR: https://forge.autodesk.com/blog/handling-custom-meshes-selection-along-model-components-forge-viewer

Since Forge Viewer is based on three.js, when customizing the Viewer, you either rely on Viewer's API, or you can go deeper, use three.js API or even more deeper, WebGL.

在您的情況下,您使用 three.js 創建了一個自定義幾何圖形,該幾何圖形低於查看器 API 的級別,並且您不能期望查看器可以與其交互。 因此,由於(通過創建 three.js 幾何)您處於 three.js 級別,您將不得不依賴 three.js ZDB974238714CA14 來處理自定義幾何選擇。38DE634A7CED 幾何選擇為了實現這一點,通常使用光線投射,並且有很多關於它的教程,其中一些是:

這些是通用的,在 Forge 的一篇博客文章中,有一個 Forge Viewer 上下文中的光線投射說明: https://forge.autodesk.com/blog/handling-custom-meshes-selection-along-model-components-偽造查看器

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM