1

와 SKShapeNode를 사용하여 충돌 감지하지 I 원처럼 다음 UIBezierPath을 가지고 있지만 그 안에 격차 : enter image description hereUIBezierpath

var centerPosition = CGPointMake(self.frame.width/2, self.frame.height/2) 
var aPath:UIBezierPath = UIBezierPath(arcCenter: centerPosition, radius: 75, startAngle: 0, endAngle: degreesToRadians(size), clockwise: true) 
gapeCircle = SKShapeNode(path: myPath, centered: true) 

는 지금은되도록 SKPhysicsBody을 사용하고 싶습니다 개체가이 개체의 윤곽선과 충돌하면 알림이 표시됩니다. 그러나 그 상황에서만. 물체가 갭 위치에서 "충돌"하면 알림이 없어야합니다.

그러나 문제를 해결하는 방법을 찾을 수 없습니다. 이미 여러 다른 SKPhysicsBody-initializers를 시도했습니다. 작동 한 유일한 사람은 circleOfRadius 이었지만 개체가 내 원의 "틈이없는"부분과 충돌하는 경우에만 충돌을 확인해야하므로 작동하지 않는 방식으로 작동합니다.

답변

0

닫힌 UIBezierPath를 사용하고 있지 않기 때문에 의심 스럽습니다. 다음 코드는 'C'값을 1pt로 줄이는 곡선을 만듭니다.

var centerPosition = CGPointMake(self.frame.width/2, self.frame.height/2) 
var aPath:UIBezierPath = UIBezierPath(arcCenter: centerPosition, radius: 75, startAngle: 0, endAngle: degreesToRadians(size), clockwise: true) 
var aPath:UIBezierPath = UIBezierPath(arcCenter: centerPosition, radius: 74, startAngle: degreesToRadians(size), endAngle: 0, clockwise: false) 
gapeCircle = SKShapeNode(path: myPath, centered: true) 
+0

답을 알려 주셔서 감사합니다. 내가 집에 왔을 때 확인할거야. – Christian

+0

결국 그 속임수를합니까? 즐거운 휴일! –