Swift 在SCN测量中增加线的厚度
我已经创建了一条线,但是我不能增加它的厚度 有没有Swift 在SCN测量中增加线的厚度,swift,scenekit,Swift,Scenekit,我已经创建了一条线,但是我不能增加它的厚度 有没有firstMaterial的东西可以用来增加线条的粗细 这是我的职责: func getDrawnLineFrom(pos1: SCNVector3, toPos2: SCNVector3) -> SCNNode { let line = lineFrom(vector: pos1, toVector: toPos2) let lineInBetween1 = SCNNode(geometry: line)
firstMaterial
的东西可以用来增加线条的粗细
这是我的职责:
func getDrawnLineFrom(pos1: SCNVector3, toPos2: SCNVector3) -> SCNNode {
let line = lineFrom(vector: pos1, toVector: toPos2)
let lineInBetween1 = SCNNode(geometry: line)
line.firstMaterial?.diffuse.contents = UIColor.blue
return lineInBetween1
}
func lineFrom(vector vector1: SCNVector3, toVector vector2: SCNVector3) -> SCNGeometry{
let indices: [Int32] = [0, 1]
let source = SCNGeometrySource(vertices: [vector1, vector2])
let element = SCNGeometryElement(indices: indices, primitiveType: .line)
return SCNGeometry(sources: [source], elements: [element])
}
它是什么样的几何学
SCNPlane
和SCNBox
具有width
和height
属性,可用于指定线条的长度和厚度。
如果它是
SCNShape
您可以在创建它的路径上定义厚度。更新了问题!希望你能帮助我!不幸的是,它一点帮助都没有……因为你不能,至少不能使用line原语类型,基本上所有的备选方案都在上面的线程中讨论或链接,这就是为什么我将其标记为Duplicate!非常感谢。我刚才说了红色,也许可以用这个圆筒