O'Reilly logo

iOS Game Development By Example by Samanyu Chopra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

SKPhysicsBody

A node's physicsBody property uses the SKPhysicsBody class object. In the life cycle of a frame, the didSimulatePhysics function is called just after actions are evaluated. The work of this function is to calculate the physical properties, such as gravity, velocity, friction, restitution, collision, or other forces. After these calculations are done, the positions and orientations of nodes are updated in the update function. If we are going to apply some force on a node, it is necessary that we assign the SKPhysicsBody object to that node first.

Sprite Kit provides us with two kinds of physics bodies:

  • Volume-based: These are the kind of physics bodies that have mass and volume
  • Edge-based: These are the kind of physics bodies that don't ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required