Ok, from what I understand materials can be created for .dae or any 3D model being used as an SCNNode in Xcode here, in the model's editor:
The topmost material gets applied automatically and all is well. My problem is that I want to programmatically SWITCH between these materials that have been created throughout my game.
I tried to get an array of these materials by doing:
node.geometry?.materials
however this only returns that first material. Ive tried everybting but cant find a way to get the other materials and switch to them. Right now I am trying:
childNode.geometry?.materials = [(childNode.geometry?.material(named: "test"))!]
//childNode is the node
where test was that second material but it finds that as nil. How can I programmatically switch between multiple materials?