ios - SceneKit material being filled with random patterns, why? -


i have simple touch detection method should change color of node being touched.

override func touchesbegan(touches: set<nsobject>, withevent event: uievent) {     super.touchesbegan(touches, withevent: event)      let touch = touches.first as! uitouch     let point = touch.locationinview(view)      let options: [nsobject : anyobject] = [         scnhittestfirstfoundonlykey: nsnumber(bool: true),         scnhittestsortresultskey: nsnumber(bool: true)     ]      if let results = sceneview.hittest(point, options: options) as? [scnhittestresult] {         if let result = results.first {             // red color material             let material = scnmaterial()             material.diffuse.contents = uicolor.redcolor()              // assign node             result.node.geometry?.firstmaterial = material         }     } } 

my node hierarchy contains 1 node made using custom scngeometry , 8 nodes regular scnbox geometry.

let boxgeometry = scnbox(width: 1, height: 1, length: 1, chamferradius: 0) let boxnode = scnnode(geometry: boxgeometry) boxnode.position = scnvector3(x: vector.x, y: vector.y, z: vector.z) 

here's couple screenshots of how color changes after touch box. pattern flickers , change on every rotation.

enter image description here enter image description here

what cause of strange color pattern? want stay solid color.

it looks me you've got 2 nodes inside each other - number of boxes doesn't add number specified in question.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -