<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/ShapeResource/generateBox(width:height:depth:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation13ShapeResourceC11generateBox5width6height5depthACSf_S2ftFZ"
  },
  "title" : "generateBox(width:height:depth:)"
}
-->

# generateBox(width:height:depth:)

Creates a box shape with the specified dimensions.

```
@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

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

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

---

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)