<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/ShapeResource/generateStaticMesh(positions:faceIndices:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation13ShapeResourceC18generateStaticMesh9positions11faceIndicesACSays5SIMD3VySfGG_Says6UInt16VGtYaKFZ"
  },
  "title" : "generateStaticMesh(positions:faceIndices:)"
}
-->

# generateStaticMesh(positions:faceIndices:)

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

```
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

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

---

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)