我正在探索激光雷达及其在ARKit中的特性。我在考虑激光雷达网格上的光线投射位置(x,y)。这意味着我想在激光雷达的网格上放置一个锚,用于光线投射的位置。其目标是保持锚定物体在表面/网格上的粘性和精确性。下图给出了更好的理解

如何在光线投射中获得网格位置而不是默认的ARWorld位置。也就是说,如何将锚或盒子放在网格/ARMeshAnchor的特定位置上?
发布于 2021-07-15 11:07:24
它适用于任何LiDAR的重建网格,不仅适用于平面:
@objc func tapped(_ sender: UITapGestureRecognizer) {
let tapLocation = sender.location(in: arView)
if let result: ARRaycastResult = arView.raycast(from: tapLocation,
allowing: .estimatedPlane,
alignment: .any).first {
let resultAnchor = AnchorEntity(world: result.worldTransform)
resultAnchor.addChild(self.sphereObject(0.05, .systemRed))
arView.scene.addAnchor(resultAnchor, removerAfter: 10.0)
}
}https://stackoverflow.com/questions/68388546
复制相似问题