<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/ClothMeshResource/box(size:targetEdgeLength:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:22RealityFoundationCloth0C12MeshResourceC3box4size16targetEdgeLengthACXDs5SIMD3VySfG_SftKFZ"
  },
  "title" : "box(size:targetEdgeLength:)"
}
-->

# box(size:targetEdgeLength:)

Creates a box mesh with a topology suitable for cloth simulation.

```
@MainActor static func box(size: SIMD3<Float>, targetEdgeLength: Float = defaultTargetEdgeLength) throws -> Self
```

## Return Value

The generated box mesh resource.

## Discussion

- size: The dimensions (width, height, depth) of the generated box, in meters.
  The resulting box will extend from `-dimensions/2` to `+dimensions/2`.
- targetEdgeLength: The targeted average edge length for the generated mesh, in meters.
  The generated mesh will contain edges with a length as close as possible to this.

---

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)