Contents

patch(size:targetEdgeLength:)

Creates a rectangular patch mesh with a topology suitable for cloth simulation.

Declaration

@MainActor static func patch(size: SIMD2<Float>, targetEdgeLength: Float = defaultTargetEdgeLength) throws -> Self

Return Value

The generated patch mesh resource.

Discussion

The generated patch will be a rectangular mesh in the XZ plane, with the face normals pointing towards +Y. The patch is centered at the origin.

  • size: The dimensions (width, height) of the generated patch, in meters. The resulting patch will extend from -dimensions/2 until +dimensions/2.

  • 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.

See Also

Creating a cloth mesh