Hi all. I am new to swift and AR. I'm trying a project on AR and ran into a problem that I can't change the material on the models. With geometry such as a sphere or a cube, everything is simple. Tell me what am I doing wrong? My simple code:
@IBOutlet var sceneView: ARSCNView!
var modelNode: SCNNode!
override func viewDidLoad() {
super.viewDidLoad()
sceneView.delegate = self
sceneView.showsStatistics = true
let scene = SCNScene(named: "art.scnassets/jacket.usdz")!
modelNode = scene.rootNode.childNode(withName: "jacket", recursively: true)
let material = SCNMaterial()
material.diffuse.contents = UIImage(named: "art.scnassets/58.png")
modelNode.childNodes[0].geometry?.materials = [material]
sceneView.scene = scene