Hi everyone I'm trying to build an ARKit app that displays different scene.scn based on the image tracked. I already set the ImageTrackingConfiguration() and set the AR Resource folder. I builded two different scenes and I want to know the best practice to work with multiple scenes. I also read that many work on the node instead of the scene.
override func viewDidLoad() {
super.viewDidLoad()
sceneView.delegate = self
sceneView.autoenablesDefaultLighting = true
let primaScene = SCNScene(named: "art.scnassets/prima.scn") let secondaScene = SCNScene(named: "art.scnassets/seconda.scn")
primoNode = primaScene?.rootNode secondoNode = secondaScene?.rootNode }
later I'm trying to call a switch case to load the right scene based on the referenceImage.name property
var shapeNode: SCNNode? switch imageAnchor.referenceImage.name{ case CaffeType.deca.rawValue: shapeNode = primoNod case CaffeType.passionale.rawValue: shapeNode = secondoNode default: break }
bottom enum for the img name string
enum CaffeType : String { case deca = "cialda_deca" case passionale = "cialda_passionale" }