Expo crashes when loading asset in ExpoAR hit test

Expo 35 crashes when trying to load a .dae model into a scene after hit test. Hit test code is copied directly from Expo tutorial (Hit Testing in ARKit. A React Native Tutorial | by Evan Bacon | Exposition).

Works fine when creating simple 3D box but simply freezes without errors when trying to load model. The .dae model is only 79KB in size.

Not sure if the await ExpoTHREE.loadDaeAsync({}) code below is correct…?

onTouchesBegan = async ({ locationX: x, locationY: y }) => {
    if (!this.renderer) {
      return;
    }

    // Get the size of the renderer
    const size = this.renderer.getSize();

    // Invoke the native hit test method
    const { hitTest } = await AR.performHitTest(
      {
        x: x / size.width,
        y: y / size.height,
      },
      // Result type from intersecting a horizontal plane estimate, determined for the current frame.
      AR.HitTestResultTypes.HorizontalPlane
    );

    // Traverse the test results
    for (let hit of hitTest) {
      const { worldTransform } = hit;
      // If we've already placed a cube, then remove it
      if (this.cube) {
        this.scene.remove(this.cube);
      }

      // Add the .dae model to the scene**
      const daeModel = await ExpoTHREE.loadDaeAsync({
        asset: require('../assets/model/model.dae'),
        onAssetRequested: () => require('../assets/model/model.jpg'),
      });

      //ExpoTHREE.utils.scaleLongestSideToSize(daeModel, 0.3);

      this.scene.add(this.daeModel);



    }
  };

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.