---
title: SKPhysicsBody
framework: spritekit
role: symbol
role_heading: Class
path: spritekit/skphysicsbody
---

# SKPhysicsBody

An object that adds physics simulation to a node.

## Declaration

```swift
class SKPhysicsBody
```

## Mentioned in

Getting Started with Physics Getting Started with Physics Bodies Responding to Frame-Cycle Events

## Overview

Overview Assign a SKPhysicsBody object to the physicsBody property of the SKNode object to add physics simulation to the node. When a scene processes a new frame, it performs physics calculations on physics bodies attached to nodes in the scene. These calculations include gravity, friction, and collisions with other bodies. You can also apply your own forces and impulses to a body. After the scene completes these calculations, it updates the positions and orientations of the node objects. important: A physics body must be associated with a node before you apply forces or impulses to it. SpriteKit supports two kinds of physics bodies, volume-based bodies and edge-based bodies. When you create a physics body, its kind, size, and shape are determined by the constructor method you call. An edge-based body does not have mass or volume and is unaffected by forces or impulses in the system. Edge-based bodies are used to represent volumeless boundaries or hollow spaces in your physics simulation. In contrast, volume-based bodies are used to represent objects with mass and volume. The isDynamic property controls whether a volume-based body is affected by gravity, friction, collisions with other objects, and forces or impulses you directly apply to it. The SKPhysicsBody class defines the physical characteristics for the body when it is simulated by the scene. For volume-based bodies, the most important property is the mass property. A volume-based body is assumed to have a uniform density. You can either set the mass property directly, or you can set the body’s density property and let the physics body calculate its own mass. All values in Sprite Kit are specified using the International System of Units (SI units). The actual forces and mass values are not important so long as your game uses consistent values. When you design a game that uses physics, you define the different categories of physics objects that appear in the scene. You define up to 32 different categories of physics bodies, and a body can be assigned to as many of these categories as you want. In addition to declaring its own categories, a physics body also declares which categories of bodies it interacts with. See SKPhysicsBody. You use a similar mechanism to declare which physics field nodes (SKFieldNode) can affect the physics body. For a volume-based body, you can dynamically control how the body is affected by forces or collisions. See SKPhysicsBody.

## Topics

### First Steps

- [Getting Started with Physics Bodies](spritekit/getting-started-with-physics-bodies.md)

### Creating a Body from a Shape

- [init(circleOfRadius:)](spritekit/skphysicsbody/init(circleofradius:).md)
- [init(circleOfRadius:center:)](spritekit/skphysicsbody/init(circleofradius:center:).md)
- [init(rectangleOf:)](spritekit/skphysicsbody/init(rectangleof:).md)
- [init(rectangleOf:center:)](spritekit/skphysicsbody/init(rectangleof:center:).md)
- [init(polygonFrom:)](spritekit/skphysicsbody/init(polygonfrom:).md)

### Creating a Body from a Texture

- [Shaping a Physics Body to Match a Node’s Graphics](spritekit/shaping-a-physics-body-to-match-a-node-s-graphics.md)
- [init(texture:size:)](spritekit/skphysicsbody/init(texture:size:).md)
- [init(texture:alphaThreshold:size:)](spritekit/skphysicsbody/init(texture:alphathreshold:size:).md)

### Creating a Body from a Collection of Bodies

- [init(bodies:)](spritekit/skphysicsbody/init(bodies:).md)

### Creating an Edge-Based Physics Body

- [Creating an Edge Loop Around a Scene](spritekit/creating-an-edge-loop-around-a-scene.md)
- [init(edgeLoopFrom:)](spritekit/skphysicsbody/init(edgeloopfrom:)-8sqfy.md)
- [init(edgeFrom:to:)](spritekit/skphysicsbody/init(edgefrom:to:).md)
- [init(edgeLoopFrom:)](spritekit/skphysicsbody/init(edgeloopfrom:)-5grxu.md)
- [init(edgeChainFrom:)](spritekit/skphysicsbody/init(edgechainfrom:).md)

### Defining How Forces Affect a Physics Body

- [affectedByGravity](spritekit/skphysicsbody/affectedbygravity.md)
- [allowsRotation](spritekit/skphysicsbody/allowsrotation.md)
- [isDynamic](spritekit/skphysicsbody/isdynamic.md)

### Defining a Physics Body’s Physical Properties

- [Configuring a Physics Body](spritekit/configuring-a-physics-body.md)
- [mass](spritekit/skphysicsbody/mass.md)
- [density](spritekit/skphysicsbody/density.md)
- [area](spritekit/skphysicsbody/area.md)
- [friction](spritekit/skphysicsbody/friction.md)
- [restitution](spritekit/skphysicsbody/restitution.md)
- [linearDamping](spritekit/skphysicsbody/lineardamping.md)
- [angularDamping](spritekit/skphysicsbody/angulardamping.md)

### Working with Collisions and Contacts

- [About Collisions and Contacts](spritekit/about-collisions-and-contacts.md)
- [categoryBitMask](spritekit/skphysicsbody/categorybitmask.md)
- [collisionBitMask](spritekit/skphysicsbody/collisionbitmask.md)
- [usesPreciseCollisionDetection](spritekit/skphysicsbody/usesprecisecollisiondetection.md)
- [contactTestBitMask](spritekit/skphysicsbody/contacttestbitmask.md)
- [allContactedBodies()](spritekit/skphysicsbody/allcontactedbodies().md)

### Applying Forces and Impulses to a Physics Body

- [Making Physics Bodies Move](spritekit/making-physics-bodies-move.md)
- [applyForce(_:)](spritekit/skphysicsbody/applyforce(_:).md)
- [applyTorque(_:)](spritekit/skphysicsbody/applytorque(_:).md)
- [applyForce(_:at:)](spritekit/skphysicsbody/applyforce(_:at:).md)
- [applyImpulse(_:)](spritekit/skphysicsbody/applyimpulse(_:).md)
- [applyAngularImpulse(_:)](spritekit/skphysicsbody/applyangularimpulse(_:).md)
- [applyImpulse(_:at:)](spritekit/skphysicsbody/applyimpulse(_:at:).md)

### Inspecting a Physics Body’s Position and Velocity

- [velocity](spritekit/skphysicsbody/velocity.md)
- [angularVelocity](spritekit/skphysicsbody/angularvelocity.md)
- [isResting](spritekit/skphysicsbody/isresting.md)

### Reading a Physics Body’s Node

- [node](spritekit/skphysicsbody/node.md)

### Determining Which Joints Are Connected to a Physics Body

- [joints](spritekit/skphysicsbody/joints.md)

### Interacting with Physics Fields

- [fieldBitMask](spritekit/skphysicsbody/fieldbitmask.md)
- [charge](spritekit/skphysicsbody/charge.md)

### Pinning a Physics Body to a Node’s Parent

- [Pinning and Rotating Physics Bodies](spritekit/pinning-and-rotating-physics-bodies.md)
- [pinned](spritekit/skphysicsbody/pinned.md)

### Initializers

- [init(coder:)](spritekit/skphysicsbody/init(coder:).md)
- [init(edgeChainFromPath:)](spritekit/skphysicsbody/init(edgechainfrompath:).md)
- [init(edgeFromPoint:toPoint:)](spritekit/skphysicsbody/init(edgefrompoint:topoint:).md)
- [init(edgeLoopFromPath:)](spritekit/skphysicsbody/init(edgeloopfrompath:).md)
- [init(edgeLoopFromRect:)](spritekit/skphysicsbody/init(edgeloopfromrect:).md)
- [init(polygonFromPath:)](spritekit/skphysicsbody/init(polygonfrompath:).md)
- [init(rectangleOfSize:)](spritekit/skphysicsbody/init(rectangleofsize:).md)
- [init(rectangleOfSize:center:)](spritekit/skphysicsbody/init(rectangleofsize:center:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Physics Simulation

- [Getting Started with Physics](spritekit/getting-started-with-physics.md)
- [SKPhysicsWorld](spritekit/skphysicsworld.md)
- [SKPhysicsContact](spritekit/skphysicscontact.md)
- [SKPhysicsContactDelegate](spritekit/skphysicscontactdelegate.md)
- [SKFieldNode](spritekit/skfieldnode.md)
