SCNText - 背景“讲话泡泡" [英] SCNText - background "speech bubble"

查看:29
本文介绍了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天全站免登陆