SCNText-背景“语音气泡" [英] SCNText - background "speech bubble"

查看:91
本文介绍了SCNText-背景“语音气泡"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将背景(例如语音泡沫"或矩形)插入SCNtext? 具体来说,如果我将"Hello World"作为SCNText(显然是场景中的SCNNode)插入,那么如何仅为该文本添加背景?它是一个UIimage,它将作为SCNNode插入到"Hello World"中的相同位置吗? (请记住,SceneKit中没有任何SCNNode的背景)

How can I insert a background (e.g. a "speech bubble" or a rectangle) to a SCNtext? Specifically, if I insert "Hello World" as SCNText (and obviously then as a SCNNode in the scene) then how can I add a background for that text only? Would it be a UIimage which will be inserted as a SCNNode at the same position in the "Hello World? (Keep in mind that there is nothing as background of SCNNode in SceneKit)

推荐答案

您可以将SCNPlane用作另一个SCNNode,将SCNMaterial分配给它的几何形状,然后将该材质的diffuse.contents属性设置为您想要的背景图像使用.然后,是的,将其放置在与SCNText节点相同的位置,但是position.z值比SCNText节点略低,因此它将位于它的后面.如果您打算移动或旋转文本节点,请将SCNPlane节点添加为文本节点的子节点.

You could use a SCNPlane as another SCNNode, assign a SCNMaterial to its geometry, and set the diffuse.contents property of that material to the background image you want to use. And then yes, place it at same position as the SCNText node, but with a position.z value slightly lower than the SCNText node so it will be behind it. If you plan to move to or rotate the text node, add the SCNPlane node as a child node of the text node.

这篇关于SCNText-背景“语音气泡"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆