<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/SKPhysicsBody",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "SpriteKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SKPhysicsBody"
  },
  "title" : "SKPhysicsBody"
}
-->

# SKPhysicsBody

An object that adds physics simulation to a node.

```
class SKPhysicsBody
```

## Overview

Assign a [`SKPhysicsBody`](/documentation/SpriteKit/SKPhysicsBody) object to the [`physicsBody`](/documentation/SpriteKit/SKNode/physicsBody) property of the [`SKNode`](/documentation/SpriteKit/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`](/documentation/SpriteKit/SKPhysicsBody/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`](/documentation/SpriteKit/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`](/documentation/SpriteKit/SKPhysicsBody/mass) property. A volume-based body is assumed to have a uniform density. You can either set the [`mass`](/documentation/SpriteKit/SKPhysicsBody/mass) property directly, or you can set the body’s [`density`](/documentation/SpriteKit/SKPhysicsBody/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`](/documentation/SpriteKit/SKPhysicsBody). You use a similar mechanism to declare which physics field nodes ([`SKFieldNode`](/documentation/SpriteKit/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`](/documentation/SpriteKit/SKPhysicsBody).

## Topics

### First Steps

[Getting Started with Physics Bodies](/documentation/SpriteKit/getting-started-with-physics-bodies)

Create and assign a physics body to enable physics.

### Creating a Body from a Shape

[`init(circleOfRadius:)`](/documentation/SpriteKit/SKPhysicsBody/init(circleOfRadius:))

Creates a circular physics body centered on the owning node’s origin.

[`init(circleOfRadius:center:)`](/documentation/SpriteKit/SKPhysicsBody/init(circleOfRadius:center:))

Creates a circular physics body centered on an arbitrary point.

[`init(rectangleOf:)`](/documentation/SpriteKit/SKPhysicsBody/init(rectangleOf:))

Creates a rectangular physics body centered on the owning node’s origin.

[`init(rectangleOf:center:)`](/documentation/SpriteKit/SKPhysicsBody/init(rectangleOf:center:))

Creates a rectangular physics body centered on an arbitrary point.

[`init(polygonFrom:)`](/documentation/SpriteKit/SKPhysicsBody/init(polygonFrom:))

Creates a polygonal physics body.

### Creating a Body from a Texture

[Shaping a Physics Body to Match a Node’s Graphics](/documentation/SpriteKit/shaping-a-physics-body-to-match-a-node-s-graphics)

Shape a physics body to your graphics for the right blend of collision accuracy and performance.

[`init(texture:size:)`](/documentation/SpriteKit/SKPhysicsBody/init(texture:size:))

Creates a physics body from the contents of a texture.

[`init(texture:alphaThreshold:size:)`](/documentation/SpriteKit/SKPhysicsBody/init(texture:alphaThreshold:size:))

Creates a physics body from the contents of a texture, capturing only the texels that exceed a specified transparency value.

### Creating a Body from a Collection of Bodies

[`init(bodies:)`](/documentation/SpriteKit/SKPhysicsBody/init(bodies:))

Creates a physics body that’s shaped like a union of the argument physics bodies.

### Creating an Edge-Based Physics Body

[Creating an Edge Loop Around a Scene](/documentation/SpriteKit/creating-an-edge-loop-around-a-scene)

Border your scene with an obstacle that physics bodies cannot penetrate.

[`init(edgeLoopFrom:)`](/documentation/SpriteKit/SKPhysicsBody/init(edgeLoopFrom:)-8sqfy)

Creates an edge loop from a rectangle.

[`init(edgeFrom:to:)`](/documentation/SpriteKit/SKPhysicsBody/init(edgeFrom:to:))

Creates an edge between two points.

[`init(edgeLoopFrom:)`](/documentation/SpriteKit/SKPhysicsBody/init(edgeLoopFrom:)-5grxu)

Creates an edge loop from a path.

[`init(edgeChainFrom:)`](/documentation/SpriteKit/SKPhysicsBody/init(edgeChainFrom:))

Creates an edge chain from a path.

### Defining How Forces Affect a Physics Body

[`affectedByGravity`](/documentation/SpriteKit/SKPhysicsBody/affectedByGravity)

A Boolean value that indicates whether this physics body is affected by the physics world’s gravity.

[`allowsRotation`](/documentation/SpriteKit/SKPhysicsBody/allowsRotation)

A Boolean value that indicates whether the physics body is affected by angular forces and impulses applied to it.

[`isDynamic`](/documentation/SpriteKit/SKPhysicsBody/isDynamic)

A Boolean value that indicates whether the physics body is moved by the physics simulation.

### Defining a Physics Body’s Physical Properties

[Configuring a Physics Body](/documentation/SpriteKit/configuring-a-physics-body)

Move a physics body, and make it collide with other objects, by setting its physical properties once or changing them dynamically.

[`mass`](/documentation/SpriteKit/SKPhysicsBody/mass)

The mass of the body, in kilograms.

[`density`](/documentation/SpriteKit/SKPhysicsBody/density)

The density of the object, in kilograms per square meter.

[`area`](/documentation/SpriteKit/SKPhysicsBody/area)

The area covered by the body.

[`friction`](/documentation/SpriteKit/SKPhysicsBody/friction)

The roughness of the surface of the physics body.

[`restitution`](/documentation/SpriteKit/SKPhysicsBody/restitution)

The bounciness of the physics body.

[`linearDamping`](/documentation/SpriteKit/SKPhysicsBody/linearDamping)

A property that reduces the body’s linear velocity.

[`angularDamping`](/documentation/SpriteKit/SKPhysicsBody/angularDamping)

A property that reduces the body’s rotational velocity.

### Working with Collisions and Contacts

[About Collisions and Contacts](/documentation/SpriteKit/about-collisions-and-contacts)

Learn how to set up nodes for collision detection.

[`categoryBitMask`](/documentation/SpriteKit/SKPhysicsBody/categoryBitMask)

A mask that defines which categories this physics body belongs to.

[`collisionBitMask`](/documentation/SpriteKit/SKPhysicsBody/collisionBitMask)

A mask that defines which categories of physics bodies can collide with this physics body.

[`usesPreciseCollisionDetection`](/documentation/SpriteKit/SKPhysicsBody/usesPreciseCollisionDetection)

A Boolean value that determines whether the physics world uses an iterative collision detection algorithm.

[`contactTestBitMask`](/documentation/SpriteKit/SKPhysicsBody/contactTestBitMask)

A mask that defines which categories of physics bodies cause intersection notifications with this physics body.

[`allContactedBodies()`](/documentation/SpriteKit/SKPhysicsBody/allContactedBodies())

The physics bodies that this physics body is in contact with.

### Applying Forces and Impulses to a Physics Body

[Making Physics Bodies Move](/documentation/SpriteKit/making-physics-bodies-move)

Move a body using various physics properties, like velocity, gravity or impulses.

[`applyForce(_:)`](/documentation/SpriteKit/SKPhysicsBody/applyForce(_:))

Applies a force to the center of gravity of a physics body.

[`applyTorque(_:)`](/documentation/SpriteKit/SKPhysicsBody/applyTorque(_:))

Applies torque to an object.

[`applyForce(_:at:)`](/documentation/SpriteKit/SKPhysicsBody/applyForce(_:at:))

Applies a force to a specific point of a physics body.

[`applyImpulse(_:)`](/documentation/SpriteKit/SKPhysicsBody/applyImpulse(_:))

Applies an impulse to the center of gravity of a physics body.

[`applyAngularImpulse(_:)`](/documentation/SpriteKit/SKPhysicsBody/applyAngularImpulse(_:))

Applies an impulse that imparts angular momentum to an object.

[`applyImpulse(_:at:)`](/documentation/SpriteKit/SKPhysicsBody/applyImpulse(_:at:))

Applies an impulse to a specific point of a physics body.

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

[`velocity`](/documentation/SpriteKit/SKPhysicsBody/velocity)

The physics body’s velocity vector, measured in meters per second.

[`angularVelocity`](/documentation/SpriteKit/SKPhysicsBody/angularVelocity)

The physics body’s angular speed.

[`isResting`](/documentation/SpriteKit/SKPhysicsBody/isResting)

A Boolean property that indicates whether the object is at rest within the physics simulation.

### Reading a Physics Body’s Node

[`node`](/documentation/SpriteKit/SKPhysicsBody/node)

The node that this body is connected to.

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

[`joints`](/documentation/SpriteKit/SKPhysicsBody/joints)

The joints connected to this physics body.

### Interacting with Physics Fields

[`fieldBitMask`](/documentation/SpriteKit/SKPhysicsBody/fieldBitMask)

A mask that defines which categories of physics fields can exert forces on this physics body.

[`charge`](/documentation/SpriteKit/SKPhysicsBody/charge)

The electrical charge of the physics body.

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

[Pinning and Rotating Physics Bodies](/documentation/SpriteKit/pinning-and-rotating-physics-bodies)

Pin a node so it’s free to rotate about a certain point on its parent node.

[`pinned`](/documentation/SpriteKit/SKPhysicsBody/pinned)

A Boolean value that indicates whether the physics body’s node is pinned to its parent node.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)