title: Physics bodies for irregular shapes in spritekit
body: <p>I have made the following code for one of my physics bodies:</p>
  
  <pre class="lang-m prettyprint-override"><code>    CGFloat offsetX = ship.frame.size.width * ship.anchorPoint.x;
      CGFloat offsetY = ship.frame.size.height * ship.anchorPoint.y;
  
      CGMutablePathRef path2 = CGPathCreateMutable();
  
      CGPathMoveToPoint(path2, NULL, 10 - offsetX, 1 - offsetY);
      CGPathAddLineToPoint(path2, NULL, 8 - offsetX, 12 - offsetY);
      CGPathAddLineToPoint(path2, NULL, 10 - offsetX, 14 - offsetY);
      CGPathAddLineToPoint(path2, NULL, 10 - offsetX, 37 - offsetY);
      CGPathAddLineToPoint(path2, NULL, 5 - offsetX, 44 - offsetY);
      CGPathAddLineToPoint(path2, NULL, 0 - offsetX, 36 - offsetY);
      CGPathAddLineToPoint(path2, NULL, 0 - offsetX, 16 - offsetY);
      CGPathAddLineToPoint(path2, NULL, 2 - offsetX, 11 - offsetY);
      CGPathAddLineToPoint(path2, NULL, 0 - offsetX, 1 - offsetY);
      CGPathAddLineToPoint(path2, NULL, 0 - offsetX, 0 - offsetY);
      CGPathAddLineToPoint(path2, NULL, 10 - offsetX, 0 - offsetY);
  
      CGPathCloseSubpath(path2);
  
      ship.physicsBody = [SKPhysicsBody bodyWithPolygonFromPath:path2];
  </code></pre>
  
  <p>It seems fine to me but whenever I run it I get an error that says: "Thread 1: signal SIGABRT".
  Does anyone see anything wrong with my code or know why this wouldn't be working?
  If you need me to specify anything just ask and I'll be glad to.</p>