使用SCNShape和UIBezierPath绘制弧

时间:2017-10-21 03:46:49

标签: ios objective-c scenekit

我正在尝试使用以下代码在SCNShape中绘制一块馅饼:

UIBezierPath *piePiece = [UIBezierPath bezierPath];
[piePiece addArcWithCenter: CGPointZero radius:  0.150 startAngle: 0.0 endAngle: M_PI/6  clockwise: YES];
[piePiece closePath];
SCNShape *pieShape = [SCNShape shapeWithPath: piePiece extrusionDepth: 0];
pieShape.firstMaterial.diffuse.contents = [UIColor blueColor];
pieShape.firstMaterial.doubleSided = YES;
SCNNode *pieNode = [SCNNode nodeWithGeometry: pieShape];

但我得到以下形状:

Sample 我看不到弧线。我做错了什么?

由于

1 个答案:

答案 0 :(得分:0)

必须将UIBezierPath的平坦度更改为较低的值。在Swift中:

pieShape.flatness = 0.0003