attachController method

void attachController(
  1. ARKitController controller
)

Initialize with an ARKitController from the ARKitSceneView widget.

Implementation

void attachController(ARKitController controller) {
  _controller = controller;
  _trackingState = ArTrackingState.normal;

  // Listen for plane anchors
  controller.onAddNodeForAnchor = (anchor) {
    if (anchor is ARKitPlaneAnchor) {
      final pose = ArPose.fromMatrix4(anchor.transform);
      _planeController.add(ArPlane(
        id: anchor.identifier,
        type: ArPlaneType.horizontalUp,
        centerPose: pose,
        extentX: anchor.extent.x,
        extentZ: anchor.extent.z,
      ));
    }
  };
}