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

# cylinder(height:radius:withCaps:targetEdgeLength:)

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

```
@MainActor static func cylinder(height: Float, radius: Float, withCaps: Bool, targetEdgeLength: Float = defaultTargetEdgeLength) throws -> Self
```

## Return Value

The generated cylinder mesh resource.

## Discussion

- height: The height of the cylinder, in meters.
- radius: The radius of the generated cylinder, in meters.
- withCaps: If `true`, the cylinder mesh will be fully closed with two flat caps;
  if `false`, the two extremes will be left open.
- 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)