如何使用 realitykit/ar kit 等快速将 AR 对象放置在真实世界的真实经度和纬度?

问题描述 投票:0回答:0

对不起,如果问题是基本的,我是一个新手。但我似乎找不到任何东西来完成我想要的。这是我当前的代码,它应该将我生成的文本实体放置在世界上特定的经度和纬度 (43/-76)。但是,尽管我在亚洲,但我可以看到该文本,即使它只放置在北美。发生了什么事!

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
        guard let location = locations.last else { return }
        let position = SIMD3<Float>(43.037682, 7, -76.135040)

        // Create a red sphere with a radius of 0.1 meters
        let textMesh = MeshResource.generateText("Hendricks Chapel", extrusionDepth: 1)
        let textMaterial = SimpleMaterial(color: .orange, isMetallic: false)
        let textModel = ModelEntity(mesh: textMesh, materials: [textMaterial])

        let modelAnchor = AnchorEntity(world: position)
        modelAnchor.addChild(textModel)
        arView.scene.addAnchor(modelAnchor)
    }

我觉得这个位置并没有放在现实世界中。 7 只是一个高度点。

swift augmented-reality arkit simd realitykit
© www.soinside.com 2019 - 2024. All rights reserved.