如何显示两个 SCNVector3 点之间的 3D 路径
我想显示两个 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])
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 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.