[ad_1]
I’ve a easy view with a background ARSession operating. The ARSession ought to maintain monitor of the digital camera location (person location).
Present code:
struct TrackingPage: View {
// State variables
@State var session = ARSession()
@State var sessionDelegate: ARDelegate = ARDelegate()
// Constructor
init() {
let configuration = ARWorldTrackingConfiguration()
configuration.worldAlignment = .gravityAndHeading
configuration.planeDetection = .horizontal
self.session.delegate = self.sessionDelegate
self.session.run(configuration)
}
// View physique
var physique: some View {
VStack {
Textual content("monitoring")
}
}
}
class ARDelegate : NSObject, ARSessionDelegate {
func session(_ session: ARSession, didUpdate body: ARFrame) {
change body.digital camera.trackingState {
case .regular:
print(body.timestamp, ",", body.digital camera.rework.columns.3.x, ",", body.digital camera.rework.columns.3.z)
default:
print(body.timestamp, ",", body.digital camera.trackingState)
}
}
}
The code works as anticipated nevertheless I observed that some peaks happen.
The next graph reveals the x and z coordinates adjustments all through the run:

What may very well be the trigger for such peaks?
[ad_2]
