【问题标题】:Flutter ARCore Plugin onNodeTap and onPlaneTap don't workFlutter ARCore 插件 onNodeTap 和 onPlaneTap 不起作用
【发布时间】:2020-09-24 07:28:59
【问题描述】:

我有一个带有 Fluttern 的基本 AR 应用程序,使用 arcore_flutter_plugin 插件,我是按照一些教程制作的。当arCoreController.onNodeTaponPlaneTap 被触发时,我正在尝试执行一些操作。但这似乎不起作用。代码没有显示错误,但是当我点击节点或平面时没有任何反应。

  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')),
    );
  }

可能是什么问题?

【问题讨论】:

    标签: flutter arcore


    【解决方案1】:

    您需要将enableTapRecognizer 设置为true

    例如:

    body: ArCoreView(
      enableTapRecognizer: true,
      onArCoreViewCreated: _onArCoreViewCreated,
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-30
      • 2014-12-07
      • 1970-01-01
      • 2021-10-29
      相关资源
      最近更新 更多