Created
September 6, 2018 11:39
-
-
Save shrawan2015/62d27202394101e4eca4e3d9ba0e67a1 to your computer and use it in GitHub Desktop.
Add text on node.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
createTextNode(title: planetsName[index], size: 0.5, planetNode: childNode) | |
func createTextNode(title: String, size: CGFloat, x: Float, y: Float , planetNode:SCNNode){ | |
let text = SCNText(string: title, extrusionDepth: 0) | |
text.firstMaterial?.diffuse.contents = UIColor.white | |
text.font = UIFont(name: "Avenir Next", size: size) | |
let textNode = SCNNode(geometry: text) | |
textNode.scale = SCNVector3(0.3,0.3,0.3) | |
textNode.position = SCNVector3(x:-0.4 ,y: 0.2, z:0 ) | |
planetNode.addChildNode(textNode) | |
} | |
//Demo example | |
https://github.com/shrawan2015/Solar-System/blob/master/Solar-System%20Final/ViewController.swift |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment