79483394

Date: 2025-03-04 10:43:40
Score: 6 🚩
Natty:
Report link

Have you been able to resolve your issue ? I am having same problem I tried with javascript incetion but it did not work.

 ModelViewer(
              src: 'assets/model.glb', // Your model path
              id: 'myModelViewer',
              ar: true,
              cameraControls: true,
              onModelViewerCreated: (controller) {
                controller.runJavaScript("""
                  let points = [];
                  const modelViewer = document.querySelector("#myModelViewer");

                  modelViewer.addEventListener('scene-graph-ready', () => {
                    modelViewer.addEventListener("click", async (event) => {
                      const hit = await modelViewer.positionAndNormalFromPoint(event.clientX, event.clientY);
                      if (hit) {
                        points.push(hit.position);
                        if (points.length === 2) {
                          let dx = points[0].x - points[1].x;
                          let dy = points[0].y - points[1].y;
                          let dz = points[0].z - points[1].z;
                          let distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
                          // Send the calculated distance to Flutter
                          window.flutter_inappwebview.callHandler('distanceCalculated', distance);
                          points = [];  // Reset after measuring
                        }
                      }
                    });
                  });
                """);
              },
            ),

Since onModelViewerCreated is not invoking

Reasons:
  • Blacklisted phrase (1.5): Have you been able to
  • Blacklisted phrase (1): did not work
  • RegEx Blacklisted phrase (1.5): resolve your issue ?
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): I am having same problem
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: Przemo