---
title: ClothMeshResource
framework: realitykit
role: symbol
role_heading: Class
path: realitykit/clothmeshresource
---

# ClothMeshResource

A mesh resource that defines the topology and shape of a cloth body or a mesh-shaped cloth collider.

## Declaration

```swift
final class ClothMeshResource
```

## Overview

Overview Use this resource as the mesh for a mesh or a mesh.

## Topics

### Creating a cloth mesh

- [init(positions:triangleIndices:)](realitykit/clothmeshresource/init(positions:triangleindices:).md)
- [patch(size:targetEdgeLength:)](realitykit/clothmeshresource/patch(size:targetedgelength:).md)
- [box(size:targetEdgeLength:)](realitykit/clothmeshresource/box(size:targetedgelength:).md)
- [sphere(radius:targetEdgeLength:)](realitykit/clothmeshresource/sphere(radius:targetedgelength:).md)
- [capsule(height:radius:targetEdgeLength:)](realitykit/clothmeshresource/capsule(height:radius:targetedgelength:).md)
- [cylinder(height:radius:withCaps:targetEdgeLength:)](realitykit/clothmeshresource/cylinder(height:radius:withcaps:targetedgelength:).md)
- [defaultTargetEdgeLength](realitykit/clothmeshresource/defaulttargetedgelength.md)

### Accessing vertex data

- [vertexCount](realitykit/clothmeshresource/vertexcount.md)
- [positions](realitykit/clothmeshresource/positions.md)
- [position(at:)](realitykit/clothmeshresource/position(at:).md)
- [withPositions(_:)](realitykit/clothmeshresource/withpositions(_:).md)
- [vertexIndex(at:)](realitykit/clothmeshresource/vertexindex(at:).md)
- [vertexIndex(primitive:vertex:)](realitykit/clothmeshresource/vertexindex(primitive:vertex:).md)
- [vertices(in:center:orientation:)](realitykit/clothmeshresource/vertices(in:center:orientation:).md)

### Inspecting mesh geometry

- [isWatertight](realitykit/clothmeshresource/iswatertight.md)
- [volume](realitykit/clothmeshresource/volume.md)

### Initializers

- [init(from:)](realitykit/clothmeshresource/init(from:).md)

### Instance Properties

- [indexCount](realitykit/clothmeshresource/indexcount.md)

## Relationships

### Conforms To

- [Equatable](swift/equatable.md)
- [Resource](realitykit/resource.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Cloth resources

- [ClothPoseResource](realitykit/clothposeresource.md)
