我试图在SceneView中绘制圆圈,但它填充了内部。 还有一种增加分段数的方法,它看起来像一个多边形。
如果您想知道为什么我要使用UIBezierPath画圆,我想根据一些参数动态更改其端角。
let r:CGFloat = 5
let center = CGPoint(x: 0, y: 0)
let path = UIBezierPath(arcCenter:center,
radius: r,
startAngle: CGFloat(0),
endAngle:CGFloat(CGFloat.pi * 2),
clockwise: true)
path.lineWidth = 1
UIColor.clear.setFill()
path.fill()
UIColor.white.setStroke()
path.stroke()
let shape = SCNShape(path: path, extrusionDepth: 0)
shape.firstMaterial?.diffuse.contents = UIColor.white
let shapeNode = SCNNode(geometry: shape)
shapeNode.position = SCNVector3(0, 0, 0)
rootNode.addChildNode(shapeNode)