<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/MeshResource/generateBox(size:majorCornerRadius:minorCornerRadius:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation12MeshResourceC11generateBox4size17majorCornerRadius05minoriJ0ACs5SIMD3VySfG_S2ftFZ"
  },
  "title" : "generateBox(size:majorCornerRadius:minorCornerRadius:)"
}
-->

# generateBox(size:majorCornerRadius:minorCornerRadius:)

Creates a box mesh from a vector of three scalar values that represent width, height, and depth, respectively, and radii for the corners.

```
@MainActor @preconcurrency static func generateBox(size: SIMD3<Float>, majorCornerRadius: Float = 0.2, minorCornerRadius: Float = 0.05) -> MeshResource
```

## Parameters

`size`

The length of the box’s width, height, and depth, in meters,
along the x-, y-, and z-axis, respectively.

`majorCornerRadius`

The radius of each corner’s circular arc,
in meters, orthogonal to the z-axis.

`minorCornerRadius`

The radius of each corner’s circular arc,
in meters, orthogonal to the x-axis.

## Discussion

The method centers the box at the entity’s origin and aligns the box’s
faces with the coordinate system’s axes.

---

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)