0

I am trying to draw circle in a sceneView but it fills the inside. Also is there a way to increase segment number it looks like a polygon.

In case you wonder why I use UIBezierPath to draw circle, I want to change its end angle dynamically according to some parameters.

    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)
Hope
  • 2,096
  • 3
  • 23
  • 40
  • SCNShape just be built from closed Bezier paths and will always be filled check this question : https://stackoverflow.com/questions/31049103/scenekit-draw-curved-line – Kishan Bhatiya Jan 02 '20 at 07:24
  • I am afraid I will end up with SCNGeometrySource thing. – Hope Jan 02 '20 at 07:31

0 Answers0