3

I don't want to change ANYTHING other than the body that defines the shape of a SKPhysicsBody. How do I do this?

I can't seem to find where I can change this.

Or even commentary on how to change it.

Yes, I know this has to be done carefully, so that it avoids all possible new collisions, overlaps, etc. But putting that aside, how do I change the body of an SKPhysicsBody?

Confused
  • 6,048
  • 6
  • 34
  • 75

1 Answers1

1

You can manually create a custom shape for a physics body using CGMutablePath, then pass it into the SKPhysicsBody constructor.

For example:

let path = CGMutablePath()
path.move(to: CGPoint(.....))
path.addLine(to: CGPoint(.....))

let customPhysicsBody = SKPhysicsBody(edgeChainFrom: path)
claassenApps
  • 1,137
  • 7
  • 14