RealityKit – 将 ModelEntity 添加到 ARGeoAnchor
我在美国(德克萨斯州休斯顿),我正在尝试将Modelentity添加到一个特定的地理位置中。但是我无法在任何地方看到实体。我做错了吗?
// Geo anchor
let location = CLLocationCoordinate2D(latitude: 30.0374898290727,
longitude: -95.58518171314036)
let geoAnchor = ARGeoAnchor(coordinate: location, altitude: 70)
arView.session.add(anchor: geoAnchor)
let geoAnchorEntity = AnchorEntity(anchor: geoAnchor)
arView.scene.anchors.append(geoAnchorEntity)
let box = ModelEntity(mesh: MeshResource.generateBox(size: 0.5),
materials: [SimpleMaterial(color: .green, isMetallic: true)])
geoAnchorEntity.addChild(box)
I am in USA (Houston, TX) and I am trying to add a ModelEntity in RealityKit to a specific geo location. But I am not able to see the entity anywhere. Am I doing something wrong?
// Geo anchor
let location = CLLocationCoordinate2D(latitude: 30.0374898290727,
longitude: -95.58518171314036)
let geoAnchor = ARGeoAnchor(coordinate: location, altitude: 70)
arView.session.add(anchor: geoAnchor)
let geoAnchorEntity = AnchorEntity(anchor: geoAnchor)
arView.scene.anchors.append(geoAnchorEntity)
let box = ModelEntity(mesh: MeshResource.generateBox(size: 0.5),
materials: [SimpleMaterial(color: .green, isMetallic: true)])
geoAnchorEntity.addChild(box)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ARGeoAnchoring 的工作原理
ARGeoAnchoring
专门在户外工作,通常在主要公共街道上,靠近道路。它是如何运作的?来自库比蒂诺的汽车使用强大的 360° LiDAR 扫描道路沿线的环境,然后将扫描结果(在 Apple 地图中称为本地化图像
)上传到服务器。考虑一下,当用户运行 ARGeo 配置时,必须连接互联网。使用 ARGeo 配置运行会话可使用 GPS、地图数据和 iPhone 指南针跟踪您的位置。如果您的位置与 Apple 汽车经过的坐标相匹配,那么您设备的传感器“看到”的内容(我的意思是 RGB 摄像头、GPS 和 IMU 数据)将与 Apple 服务器上存储的数据进行比较。根据匹配,将创建(或不会创建)位置锚点。
为什么这么复杂?答案很明显:仅靠 GPS 并不能提供高精度的位置锚定位。支持 GPS 的智能手机的精确度通常在 5 米以内。
有关更多信息,请阅读这篇文章和这篇文章。
How ARGeoAnchoring works
ARGeoAnchoring
exclusively works outdoors, usually on the main public streets, next to the roadways. How does it work? Well, cars from Cupertino use power 360˚ LiDARs to scan the environment along the road, and then the scanned results (calledlocalization imagery
for Apple Maps) are uploaded to a server. Consider, internet connection is compulsory when users are running ARGeo configuration.Running session with ARGeo config tracks your locations with GPS, map data, and iPhone's compass. If your location matches the coordinates that the Apple car passed, then what your device's sensors "see" (I mean RGB camera, GPS and IMU data) is compared with the data that's stored on Apple server. And based on the matches, a location anchor will be created (or will not be created).
Why is it so complicated? The answer is obvious: GPS alone doesn't provide a high precision for location anchor positioning. GPS-enabled smartphones are typically accurate to within 5.0 meters.
For additional info read this post and this post.