菜鸟教程小白 发表于 2022-12-11 20:21:59

ios - 我可以使用 ARKit 和 ARSK View 更改 anchor 或移动图像吗?


                                            <p><p>我正在尝试使用 ARKit 构建指南针,但在移动图像时遇到了问题。指南针由每个基本方向的 4 个 Sprite 组成,每个 Sprite 在其特定位置距离相机一米处悬停。我希望指南针围绕着相机,这样即使用户移动,指南针仍然围绕着他们。但是,我不知道第一次设置这些图像后如何移动它们的位置。</p>

<p>我知道可以在 ARSCNView 中移动节点,但我使用的是 ARSKView ,据我所知,无法移动 anchor 。如果我不移动 anchor ,我可以通过什么方式改变图像的位置? ARSK View 甚至可以实现这一点,还是我应该放弃并切换到 ARSCN View?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>您的用例表明您实际上并不需要在 3D 中“移动”的元素,而是需要 3D 位置相对于相机固定的元素。这种事情在像 SceneKit 这样的 3D 框架中是微不足道的,但当你试图在 ARKit(主要关注世界相对位置)和“伪造”3D 效果的 2D 框架之间的空间中工作时,会困难得多用于 2D 内容。</p>

<p>在 SceneKit 中,您可以通过将节点设为 <a href="https://developer.apple.com/documentation/scenekit/scnscenerenderer/1523982-pointofview" rel="noreferrer noopener nofollow"><code>pointOfView</code></a> 的子节点来使节点跟随相机。节点。当然,这将使它们不仅跟随相机的位置,而且还跟随方向。如果您想有选择地跟随相机变换的某些方面而不是其他方面,您最好将节点层次结构与 <a href="https://developer.apple.com/documentation/scenekit/constraints" rel="noreferrer noopener nofollow">constraints</a> 结合起来。 — 例如,带有 <a href="https://developer.apple.com/documentation/scenekit/scntransformconstraint/2867503-orientationconstraint" rel="noreferrer noopener nofollow">world space orientation constraint</a> 的相机节点的子节点总是返回标识,因此节点跟随相机的位置而不是它的方向。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 我可以使用 ARKit 和 ARSK View 更改 anchor 或移动图像吗?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/51355045/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/51355045/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 我可以使用 ARKit 和 ARSK View 更改 anchor 或移动图像吗?