RealityKit – 将 ModelEntity 添加到 ARGeoAnchor

发布于 2025-01-20 01:00:44 字数 660 浏览 0 评论 0原文

我在美国(德克萨斯州休斯顿),我正在尝试将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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

奢欲 2025-01-27 01:00:44

ARGeoAnchoring 的工作原理

ARGeoAnchoring 专门在户外工作,通常在主要公共街道上,靠近道路。它是如何运作的?来自库比蒂诺的汽车使用强大的 360° LiDAR 扫描道路沿线的环境,然后将扫描结果(在 Apple 地图中称为本地化图像)上传到服务器。考虑一下,当用户运行 ARGeo 配置时,必须连接互联网。

使用 ARGeo 配置运行会话可使用 GPS、地图数据和 iPhone 指南针跟踪您的位置。如果您的位置与 Apple 汽车经过的坐标相匹配,那么您设备的传感器“看到”的内容(我的意思是 RGB 摄像头、GPS 和 IMU 数据)将与 Apple 服务器上存储的数据进行比较。根据匹配,将创建(或不会创建)位置锚点。

为什么这么复杂?答案很明显:仅靠 GPS 并不能提供高精度的位置锚定位。支持 GPS 的智能手机的精确度通常在 5 米以内。

为了精确放置位置锚点,地理跟踪需要比单独使用 GPS 更好地了解用户的地理位置。 ARKit 根据用户的 GPS 坐标下载描绘该区域物理环境的图像。苹果通过捕捉街道视图的照片并记录每张照片的地理位置来提前收集定位图像。通过将设备的当前相机图像与此图像进行比较,会话将用户的精确地理位置与场景的本地坐标进行匹配。

有关更多信息,请阅读这篇文章这篇文章

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 (called localization 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.

To place location anchors with precision, geotracking requires a better understanding of the user’s geographic location than is possible with GPS alone. Based on the user's GPS coordinates, ARKit downloads imagery that depicts the physical environment in that area. Apple collects this localization imagery in advance by capturing photos of the view from the street and recording the geographic position at each photo. By comparing the device's current camera image with this imagery, the session matches the user’s precise geographic location with the scene's local coordinates.

For additional info read this post and this post.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文