Flutter ARCore Plugin onNodeTap and onPlaneTap don't work

262

You need to set enableTapRecognizer to true.

For example:

body: ArCoreView(
  enableTapRecognizer: true,
  onArCoreViewCreated: _onArCoreViewCreated,
)
Share:
262
RishiC
Author by

RishiC

Updated on December 24, 2022

Comments

  • RishiC
    RishiC over 1 year

    I have a basic AR app with Fluttern, using the arcore_flutter_plugin plugin, which I made following some tutorials. I am trying to do some actions when the arCoreController.onNodeTap and onPlaneTap are triggered. But it doesn't seem to work. The code shows no errors, but nothing happens when I tap the node or the plane.

      void _onArCoreViewCreated(ArCoreController controller) {
        arCoreController = controller;
        arCoreController.onPlaneTap = _onPlaneTap;
        arCoreController.onNodeTap= handleTap;
      }
    
      _onPlaneTap(List<ArCoreHitTestResult> hits) => _onHitDetected(hits.first);
      void handleTap(String name){
        print('Node Tapped');
        showDialog<void>(
          context: context,
          builder: (BuildContext context) =>
              AlertDialog(content: Text('onNodeTap on $name')),
        );
      }
      void _onHitDetected(ArCoreHitTestResult plane){
        showDialog<void>(
          context: context,
          builder: (BuildContext context) =>
              AlertDialog(content: Text('On Plane Tap done')),
        );
      }
    

    What can be the problem?