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

# density

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

```
var density: CGFloat { get set }
```

## Discussion

The actual unit is arbitrary as long as relative masses of objects are consistent throughout the game.

The [`mass`](/documentation/SpriteKit/SKPhysicsBody/mass) and [`density`](/documentation/SpriteKit/SKPhysicsBody/density) properties are interrelated. When you change the value of either property, the other property’s value is automatically recalculated to be consistent.

The default value is `1.0`.

---

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)