Write text on sphere surface SceneKit?
I am wondering if there is a way to write text along a surface of a sphere object in SceneKit.
I know I put a texture on the surface and achieve this kind of effect if I have an image, but I want to know if I can just add text dynamically somehow over the surface of the sphere.
Any idea?
EDIT:
This works:
let layer = CALayer()
layer.frame = CGRectMake(0, 0, 100, 100)
layer.backgroundColor = UIColor.orangeColor().CGColor
var textLayer = CATextLayer()
textLayer.frame = layer.bounds
textLayer.fontSize = layer.bounds.size.height
textLayer.string = "Test"
textLayer.alignmentMode = kCAAlignmentLeft
textLayer.foregroundColor = UIColor.greenColor().CGColor
textLayer.display()
layer.addSublayer(textLayer)
let box = SCNBox(width: 10, height: 10, length: 10, chamferRadius: 0.5)
let boxNode = SCNNode(geometry: box)
box.firstMaterial?.locksAmbientWithDiffuse = true
boxNode.position = position
box.firstMaterial?.diffuse.contents = layer
scene.rootNode.addChildNode(boxNode)
你可以使用任何CALayer
作为你的SCNMaterialProperty
的内容:)
上一篇: 为什么在使用笑话测试节点应用程序时看不到控制台日志输出
下一篇: 在球面上写文字SceneKit?