Reputation: 267
I need the buttons to be disabled on top of Scene objects. How can i achieve that? The current code i am working is working fine but how can i get a specific child node to be transparent,
extension SCNMaterial {
convenience init(color: UIColor) {
self.init()
diffuse.contents = color
}
convenience init(image: UIImage) {
self.init()
diffuse.contents = image
}
}
let clearMaterial = SCNMaterial(color: .clear)
boxNode.materials = [clearMaterial]
Upvotes: 0
Views: 121
Reputation: 1611
Did you not get any error? SCNGeometry
not SCNNode
have material. try:
boxNode.geometry?.materials = [clearMaterial]
I tried this but it did not work. Maybe SCNMaterial
cant use .clear
I have always used .transparency
to hide/unhide node. try this:
func show(){
yourNode.geometry?.firstMaterial?.transparency = 1
}
func hide(){
yourNode.geometry?.firstMaterial?.transparency = 0
}
Upvotes: 1