iOS - Calculating distance, azimuth, elevation and relative position (Augmented Reality)

后端 未结 2 908
醉梦人生
醉梦人生 2020-12-12 18:03

I am starting to build an augmented reality app where you can place an image on the screen on your augmented reality camera view and it stays in that position on the Earth,

2条回答
  •  执笔经年
    2020-12-12 18:29

    Swift 3

    Gyroscope code update:

    import CoreMotion
    ...
            motionManager.deviceMotionUpdateInterval = 0.1
            motionManager.startDeviceMotionUpdates(to: OperationQueue.current!) { deviceManager, error in
                guard let dm = deviceManager else { return }
                let roll = dm.attitude.roll
                let pitch = dm.attitude.pitch
                let yaw = dm.attitude.yaw
    
                print("r: \(roll), p: \(pitch), y: \(yaw)")
            }
    

提交回复
热议问题