Is it possible to use an ARSCNView
, configure it with an ARWorldTrackingConfiguration
for device that support it, and configure it another way for devices that don't support it (with A8 chip and lower) and still have the video render in the background?
if ARWorldTrackingConfiguration.isSupported{
let config=ARWorldTrackingConfiguration()
config.planeDetection = .horizontal
sceneView.session.run(config)
}else if AROrientationTrackingConfiguration.isSupported{
let config=AROrientationTrackingConfiguration()
sceneView.session.run(config)
}else{
print("not supported")
//what here? <<<
}
You need a running
ARSession
to drive the camera feed to anARSCNView
, to run anARSession
you need a supportedARConfiguration
, and all configurations require A9.However, if your below-A9 fallback plan is to have a SceneKit view that doesn't get any of ARKit's motion tracking... you don't need ARKit. Just use a regular SceneKit view (
SCNView
). To make the camera feed show up behind your SceneKit content, find theAVCaptureDevice
for the camera you want, and pass that to thebackground
.
contents
of the scene in your view.(Using a capture device as a SceneKit background is new in iOS 11. It doesn't appear to be in the docs (yet?), but it's described in the WWDC17 SceneKit session.)
By the way, there aren't any devices that support orientation tracking but don't support world tracking, so the multiple-branch
if
statement in your question is sort of overkill.