I’m building a game using SpriteKit, and using the brilliant SKPhysicsBody Path Generator.
I came across a limitation of physics bodies, that their shapes need to be convex, or an error is generated(strangely, the simulator doesn’t seem to mind, but the device does!)
How to create a concave SKPhysicsBody? Create two SKPhysicsBody variables, using convex paths. You can now generate another SKPhysicsBody variable by performing a union on the two physics bodies, using the SKPhysicsBody initializer (bodyWithBodies). The two paths are convex, but the resulting body can be concave! You can achieve more complex shapes by performing a union of more than two physics bodies.