如何显示两个 SCNVector3 点之间的 3D 路径

发布于 2025-01-17 02:39:58 字数 458 浏览 1 评论 0原文

我想显示两个 SCNVector3 点之间的 3D 路径,并希望在 iOS Swift 中实现如下截图所示。从下面的代码仅显示点之间的简单线

let indices: [Int32] = [0, 1]
let source = SCNGeometrySource(vertices: [vector1, vector2])
let element = SCNGeometryElement(indices: indices, primitiveType: .line)
SCNGeometry(sources: [source], elements: [element])

在此处输入图像描述

I want to show 3D path between two SCNVector3 points and want to achieve like below screenshot in iOS Swift. from below code shows only simple line between points

let indices: [Int32] = [0, 1]
let source = SCNGeometrySource(vertices: [vector1, vector2])
let element = SCNGeometryElement(indices: indices, primitiveType: .line)
SCNGeometry(sources: [source], elements: [element])

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

§对你不离不弃 2025-01-24 02:39:58

您可以使用 lerp(线性插值)来获取起始节点和结束节点之间的点。您可以考虑一个百分比 - 例如 10、20、30,以使这些 3d 位置在起始节点和结束节点之间保持一致。

You can use a lerp (linear interpolation) to get points between the start and end nodes. You can factor in a percentage - like 10,20,30 to get those 3d positions in line between your start and end node.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文