0

I need to detect which node tapped in ArCore in flutter

arCoreController!.onNodeTap = (name) => onTapHandler(name);

didn't get the expected name.

1 Answers1

0

The below logic works perfectly fine. Please refer to this sample. If you're facing error when running this project, refer to this fix. Hope this helps !

void _onArCoreViewCreated(ArCoreController controller) {
    arCoreController = controller;
    arCoreController?.**onNodeTap** = (name) => onTapHandler(name);
    arCoreController?.onPlaneTap = _handleOnPlaneTap;
  }

...

  void onTapHandler(String name) {
    print("Flutter: onNodeTap");
    showDialog<void>(
      context: context,
      builder: (BuildContext context) =>
          AlertDialog(content: Text('onNodeTap on $name')),
    );
  }
Birender Singh
  • 513
  • 6
  • 16