---
title: "generateCapsule(height:radius:)"
framework: realitykit
role: symbol
role_heading: Type Method
path: "realitykit/shaperesource/generatecapsule(height:radius:)"
---

# generateCapsule(height:radius:)

Creates a capsule shape with the specified height and radius.

## Declaration

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

Return Value The new capsule.

## Discussion

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