Skip to content

Instantly share code, notes, and snippets.

@shrawan2015
Created September 6, 2018 11:39
Show Gist options
  • Save shrawan2015/62d27202394101e4eca4e3d9ba0e67a1 to your computer and use it in GitHub Desktop.
Save shrawan2015/62d27202394101e4eca4e3d9ba0e67a1 to your computer and use it in GitHub Desktop.
Add text on node.
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