addAnchorAtHit method

Future<UArAnchor> addAnchorAtHit(
  1. UArHitResult hit, {
  2. String? id,
  3. bool faceCamera = true,
})

Anchors to the surface of a hit, so the content follows plane refinements.

Implementation

Future<UArAnchor> addAnchorAtHit(UArHitResult hit, {String? id, bool faceCamera = true}) {
  UArPose pose = hit.pose;
  if (faceCamera && !hit.isWall) {
    final UArVector3 toCamera = value.frame.camera.position - hit.pose.position;
    pose = UArPose(position: hit.pose.position, rotation: UArQuaternion.yaw(atan2(toCamera.x, toCamera.z)));
  }
  return addAnchor(pose, id: id, trackableId: hit.trackableId);
}