0

I am able to add Custom Geometry on Forger Viewer - 2D model by doing the following,

handleSingleTap(event) {
        
          const canvasX = event.canvasX;
          const canvasY = event.canvasY;
          console.log(canvasX);
          console.log(canvasY);
          const result = this.viewer.clientToWorld(canvasX, canvasY);
          
          console.log("POINT CHECK --> ",JSON.stringify(result.point));
          if (result) { 
          const geom = new THREE.BoxGeometry(0.01, 0.01, 0,0,0,0);
          var material = new THREE.MeshBasicMaterial({ color: 0xff0000 });
          var mesh = new THREE.Mesh(geom, material); 
          mesh.position.set(result.point.x, result.point.y, result.point.z); 
          if (!this.viewer.overlays.hasScene('custom-scene')) { 
           this.viewer.overlays.addScene('custom-scene'); 
         } 
         this.viewer.overlays.addMesh(mesh, 'custom-scene');
        }
          return true; 
      }

when I zoomin and trying to add the BoxGeometry, then sometimes its visible , sometimes not visible. But when I zoomout the Forge Viewer then those Boxes becomes visible and fluctuates/cut. Here I have loaded ForgeViewer in Flutter using WebView.

As I am using 2D models to show, so user will first zoom the part and will be able to tap on Forge. So I have used CustomViewer for that.

1 Answers1

0

One suggestion would be to look at the thickness of the box. You could try making it thicker so that way you might be able to see your custom geometry whenever you zoom in and zoom out.

I came across a question on how to increase thickness in geometry edges in threejs:How to increase line thickness in three.js edges geometry using shaders?

TimmyTim
  • 56
  • 1