---
title: "generateBox(width:height:depth:)"
framework: realitykit
role: symbol
role_heading: Type Method
path: "realitykit/shaperesource/generatebox(width:height:depth:)"
---

# generateBox(width:height:depth:)

Creates a box shape with the specified dimensions.

## Declaration

```swift
@MainActor @preconcurrency static func generateBox(width: Float, height: Float, depth: Float) -> ShapeResource
```

## Parameters

- `width`: The extent of the box along the x-axis in meters.
- `height`: The extent of the box along the y-axis in meters.
- `depth`: The extent of the box along the z-axis in meters.

## Return Value

Return Value The new box centered at the local origin and aligned with the local axes.

## Discussion

Discussion note: Collision shape extents that fall below 2mm are forced to be 2mm in size - this includes, entities with negative scale values.

## See Also

### Generating boxes

- [generateBox(size:)](realitykit/shaperesource/generatebox(size:).md)
