The mass of the body, in kilograms.
SDKs
- iOS 7.0+
- macOS 10.9+
- tvOS 9.0+
- watchOS 3.0+
Framework
- Sprite
Kit
Declaration
var mass: CGFloat { get set }
Discussion
The actual unit is arbitrary as long as relative masses of objects are consistent throughout the game. The mass of the body affects its momentum as well as how forces are applied to the object.
The mass
and 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 based on the size of the physics body and the body’s default density.