---
title: "init(shapes:density:material:mode:)"
framework: realitykit
role: symbol
role_heading: Initializer
path: "realitykit/physicsbodycomponent/init(shapes:density:material:mode:)"
---

# init(shapes:density:material:mode:)

Creates a physics body component deriving mass properties from shape and density.

## Declaration

```swift
@MainActor @preconcurrency init(shapes: [ShapeResource], density: Float, material: PhysicsMaterialResource? = nil, mode: PhysicsBodyMode = .dynamic)
```

## Parameters

- `shapes`: The shape for which to estimate the mass, rotational inertia, and center of mass.
- `density`: The density of the object in kilograms per cubic meter.
- `material`: The material properties, like friction.
- `mode`: The simulation mode that indicates how a body responds to forces.

## Mentioned in

Designing scene hierarchies for efficient physics simulation

## See Also

### Creating a physics body component

- [init()](realitykit/physicsbodycomponent/init().md)
- [init(massProperties:material:mode:)](realitykit/physicsbodycomponent/init(massproperties:material:mode:).md)
- [init(shapes:mass:material:mode:)](realitykit/physicsbodycomponent/init(shapes:mass:material:mode:).md)
