I stumbled upon a roadblock with the development of a Swift playground I'm developing. I want to add an image to my ARSCNScene (ARKit + SceneKit). Not as a background, but as an actual node with positions and all. Does anyone know whether this is possible? I couldn't find anything online. Thanks!
You can easily add UIImage as diffuse material to your SCNPlane. Example:
let image = UIImage(named: "yourImageName")
let node = SCNNode(geometry: SCNPlane(width: 1, height: 1))
node.geometry?.firstMaterial?.diffuse.contents = image
Further, you can modify your node as you like. I hope it helped!
I think I found a solution too for this problem since im having the same issue
Write:
node.geometry?.firstmaterial?.diffuse.contents = #imageLiteral(resourceName: “yourimagename”)
Note that you have to add the image inside the assets first (as an image set of course)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With