April 2021
Beginner to intermediate
506 pages
11h 57m
English
There are two types of physics bodies: volume-based bodies and edge-based bodies, which are illustrated in the images that follow.

To create these physics bodies, you use the SKPhysicsBody class and one of its initializers. Typically, you’ll use an initializer that matches your sprite node’s shape, such as a rectangle, circle, polygon, or custom path. You then assign this physics body to the node’s physicsBody property, like so:
| | ball.physicsBody = SKPhysicsBody(circleOfRadius: ball.frame.width/2) |
When defining shapes, always consider performance. A circle is the most efficient shape, whereas a path-based polygon ...
Read now
Unlock full access