SCNText 不显示 [英] SCNText Not Displaying
本文介绍了SCNText 不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的 SceneKit 应用程序中有以下代码,但由于某种原因,文本从未显示在屏幕上.
I have the following code in my SceneKit application but for some reason the text never shows up on the screen.
let text = SCNText(string: item.label, extrusionDepth: 4.0)
text.firstMaterial?.diffuse.contents = UIColor.white
text.font = UIFont(name: "Arial", size: 35)
let textNode = SCNNode(geometry: text)
textNode.position = SCNVector3(-0.2 + x, -0.9 + delta, -1)
self.node.addChildNode(textNode)
推荐答案
不要使用 .font,请尝试使用 .scale.即使是字体的 1 仍然是一米高,因此可能需要将其缩小.这对我有用: textNode.scale = SCNVector3(0.01,0.01,0.01)
Instead of using .font, try using .scale. Even a 1 for font is still a meter tall, so scaling it down might be needed. This worked for me: textNode.scale = SCNVector3(0.01,0.01,0.01)
这篇关于SCNText 不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文