---
title: "init(positions:triangleIndices:)"
framework: realitykit
role: symbol
role_heading: Initializer
path: "realitykit/clothmeshresource/init(positions:triangleindices:)"
---

# init(positions:triangleIndices:)

Creates a cloth mesh resource from the given vertex positions and triangle indices.

## Declaration

```swift
@MainActor convenience init(positions: [SIMD3<Float>], triangleIndices: [UInt32]) throws
```

## Parameters

- `positions`: Positions for the vertices of the mesh.
- `triangleIndices`: Indices of the vertices forming the triangle primitives of the mesh.

## See Also

### Creating a cloth mesh

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