菜鸟教程小白 发表于 2022-12-11 18:22:08

ios - 在 SceneKit 中的平面上绘图


                                            <p><p>我在我的场景中创建了一个 SCNPlane。我将 SCNPlane 的漫反射内容设置为图像。现在我需要在飞机上显示其他细节(例如飞机的名称,以及其他简单的图形,如箭头)。 </p>

<p>这似乎是一项简单的任务,但我找不到任何相关信息。我应该创建其他几何图形并将它们附加到平面上吗?如果是这样,我该如何在不发生 z-fighting 的情况下做到这一点? </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>SceneKit 中的 Material 非常灵活。当你给 <code>diffuse</code> 或 <code>ambient</code> 属性赋值时,你是在赋值 <a href="https://developer.apple.com/documentation/scenekit/scnmaterialproperty" rel="noreferrer noopener nofollow"><code>SCNMaterialProperty</code></a> .您可以从 Apples 文档中指定:</p>

<blockquote>
<ul>
<li>An image object, or a path or URL to an image file</li>
<li>A specially formatted image or array of six images to be used as a cube map</li>
<li>A <strong>Core Animation layer or layer hierarchy</strong>, which itself may contain animated content</li>
<li>A SpriteKit texture providing a static image, or an <strong>entire SpriteKit scene</strong> rendering animated 2D content.</li>
</ul>
</blockquote>

<p>我还没有让核心动画层正常工作,也许其他人可以提供更多信息,但我一直在使用 <a href="https://developer.apple.com/spritekit/" rel="noreferrer noopener nofollow">SpriteKit</a>而且设置起来非常简单。</p>

<ol>
<li>创建一个 <code>SKScene</code> 并根据需要添加动画</li>
<li>设置场景的大小。如果您的飞机比您的尺寸大,SceneKit 会按比例放大。</li>
<li>将其添加到您的 Material<code>diffuse</code> 属性</li>
</ol></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 在 SceneKit 中的平面上绘图,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/45294754/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/45294754/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 在 SceneKit 中的平面上绘图