<!--
{
  "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/generateCapsule(height:radius:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation13ShapeResourceC15generateCapsule6height6radiusACSf_SftFZ"
  },
  "title" : "generateCapsule(height:radius:)"
}
-->

# generateCapsule(height:radius:)

Creates a capsule shape with the specified height and radius.

```
@MainActor @preconcurrency static func generateCapsule(height: Float, radius: Float) -> ShapeResource
```

## Parameters

`height`

The height of the capsule including the spherical caps in meters, measured along the local y-axis.

`radius`

The radius of the capsule in meters.

## Return Value

The new capsule.

## 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)