1

I'm developing 4-players game using ARKit. I know how to save and then to get a worldMap. It's not difficult.

sceneView.session.getCurrentWorldMap { worldMap, error in
    guard let map = worldMap
        else { self.showAlert(title: "Can't get current world map", message: error!.localizedDescription); return }

    guard let snapshotAnchor = SnapshotAnchor(capturing: self.sceneView)
        else { fatalError("Can't take snapshot") }
    map.anchors.append(snapshotAnchor)

    do {
        let data = try NSKeyedArchiver.archivedData(withRootObject: map, requiringSecureCoding: true)
        try data.write(to: self.mapSaveURL, options: [.atomic])
        DispatchQueue.main.async {
            self.loadExperienceButton.isHidden = false
            self.loadExperienceButton.isEnabled = true
        }
    } catch {
        fatalError("Can't save map: \(error.localizedDescription)")
    }
}

But I don't know how to track with iPhone the following place (it's 50x50 meters) to generate this worldMap.

enter image description here

Could you give me an idea how to track this space?

4

1 回答 1

1

如果您想在您周围的 AR 对象有效地在真实环境中移动,您应该使用整个开发人员的武器库进行精确定位:Core Location 框架(它提供用于确定设备的地理位置、高度、方向或相对于附近的位置的服务iBeacon)、iBeacon 框架和经过认证的硬件(iBeacon 位置感知的交互式可能性对于室内导航来说特别酷)、Vision 和 Core ML 框架(设计用于使用经过训练的机器学习模型来分类输入数据,如标志和图像) .

在使用上述框架之前,您应该使用 iPhone 多次跟踪整个环境(每次都将新的特征点添加到现有的特征数组中)。看下图,想象一下点云的样子:

在此处输入图像描述

附言

除了上述之外,ARKit 4.0 还为开发人员提供了诸如带有ARGeoAnchors场景重建功能的ARGeoTrackingConfiguration等工具(当您的设备配备 LiDAR 扫描仪时工作)。

于 2019-03-15T14:54:06.670 回答