📅  最后修改于: 2022-03-11 14:52:19.208000             🧑  作者: Mango
private fun tapDistanceOf2Points(hitResult: HitResult){
if (placedAnchorNodes.size == 0){
placeAnchor(hitResult, cubeRenderable!!)
}
else if (placedAnchorNodes.size == 1){
placeAnchor(hitResult, cubeRenderable!!)
val midPosition = floatArrayOf(
(placedAnchorNodes[0].worldPosition.x + placedAnchorNodes[1].worldPosition.x) / 2,
(placedAnchorNodes[0].worldPosition.y + placedAnchorNodes[1].worldPosition.y) / 2,
(placedAnchorNodes[0].worldPosition.z + placedAnchorNodes[1].worldPosition.z) / 2)
val quaternion = floatArrayOf(0.0f,0.0f,0.0f,0.0f)
val pose = Pose(midPosition, quaternion)
placeMidAnchor(pose, distanceCardViewRenderable!!)
}
else {
clearAllAnchors()
placeAnchor(hitResult, cubeRenderable!!)
}
}