---
title: "generateStaticMesh(positions:faceIndices:)"
framework: realitykit
role: symbol
role_heading: Type Method
path: "realitykit/shaperesource/generatestaticmesh(positions:faceindices:)"
---

# generateStaticMesh(positions:faceIndices:)

Creates a static collision mesh from an array of vertex positions and face indices.

## Declaration

```swift
nonisolated static func generateStaticMesh(positions: [SIMD3<Float>], faceIndices: [UInt16]) async throws -> ShapeResource
```

## Parameters

- `positions`: An array of vertex positions containing discrete points on the mesh.
- `faceIndices`: An array of integers used to index into the position array. Each three indices define a polygon in the mesh.

## Discussion

Discussion The triangle mesh is pre-processed into an optimized format before being used by the physics engine. The pre-processing step can take significant time if the position counts are large. To minimize this cost, the position count should be as small as possible. The returned ShapeResource can only be used under the following circumstances: This shape can only be used with PhysicsBodyMode.static and not .dynamic or .kinematic. This shape cannot be used with CollisionComponent.Mode.trigger.
