简体   繁体   English

画在SCNNode的脸上

[英]Draw on face of SCNNode

I am experimenting with ARKit and SceneKit and have been able to place boxes or custom shapes using UIBezierPath. 我正在尝试使用ARKit和SceneKit,并且能够使用UIBezierPath放置盒子或自定义形状。 What I'd like to do next is draw text and place images on the surface of these shapes. 我接下来要做的是绘制文本并将图像放在这些形状的表面上。 I've tried adding an image to the material property but this just fills the shape with an image. 我已经尝试将图像添加到材质属性,但这只是用图像填充形状。 I'd like to have control over the size and position of the image / text relative to the shape. 我想控制图像/文本相对于形状的大小和位置。 Is this possible? 这可能吗?

You can do so by creating a new node for your text or image, and add it as a child node of your existing SCNNode ( addChildNode ). 您可以通过为文本或图像创建新节点,并将其添加为现有SCNNode( addChildNode )的子节点来实现。 You can then position it as needed relative to your parent node, much as you have already done with your SCNNode. 然后,您可以根据需要相对于父节点定位它,就像您已经使用SCNNode一样。

For text you can make your SCNNode from an SCNText , or render the text into a bitmap and use it as a texture material of an SCNPlane . 对于文本,您可以从SCNText ,或将文本呈现为位图并将其用作SCNPlane的纹理材质。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM