getDistanceBetweenAnchors method
Returns the distance in meters between @anchor1 and @anchor2.
Implementation
Future<double?> getDistanceBetweenAnchors(
ARAnchor anchor1, ARAnchor anchor2) async {
var anchor1Pose = await getPose(anchor1);
var anchor2Pose = await getPose(anchor2);
var anchor1Translation = anchor1Pose?.getTranslation();
var anchor2Translation = anchor2Pose?.getTranslation();
if (anchor1Translation != null && anchor2Translation != null) {
return getDistanceBetweenVectors(anchor1Translation, anchor2Translation);
} else {
return null;
}
}