Swift 3 (SpriteKit): Aligning SKPhysicsBody to SKShapeNode
<p>I am creating SKShapeNodes in my program using this:</p>

<pre><code>let points = [CGPoint(x: x, y: y), CGPoint(x: x2, y: y2)]
let line = SKShapeNode(points: &amp;points, count: points.count)
</code></pre>

<p>The problem that I am having is that whenever I add a physicsBody to the line, the physicsBody is not aligned with the line. I realise that the issue is because the line's position is always CGPoint(x: 0, y: 0) so the physicsBody is always in the centre of the screen regardless of where the line is. Here is my code for creating the physicsBody:</p>

<pre><code>line.physicsBody = SKPhysicsBody(rectangleOf: (line.frame.size))
</code></pre>

<p>If anyone knows how to align the physicsBody to the line, then please reply with your solution. Thanks!</p>