我有这样的功能:
func getdrawnHorLineFrom(pos1: SCNVector3, toPos2: SCNVector3) -> SCNNode {
let obj1 = SCNVector3(x: toPos2.x, y: toPos2.y, z:pos1.z)
let line = lineFrom(vector: pos1, toVector: obj1)
let lineInBetween1 = SCNNode(geometry: line)
glLineWidth(15)
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])
}
基本上,我试图在两个3D点之间画一条线,它们是SCNVector3类型。绘制的线是一个SCNGeometry'使用primitiveType' line'。
现在,我想增加线条粗细,使其显得清晰。另外,我想知道,如果有任何办法,我可以让我的线条显示为“虚线”。我为了增加线条的厚度,尝试使用' glLineWidth()等,但没有成功。
如果有人可以帮助我,我会很高兴。
提前致谢!