<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PHASE",
  "identifier" : "/documentation/PHASE/PHASEShape/init(engine:mesh:materials:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "PHASE"
    ],
    "preciseIdentifier" : "c:objc(cs)PHASEShape(im)initWithEngine:mesh:materials:"
  },
  "title" : "init(engine:mesh:materials:)"
}
-->

# init(engine:mesh:materials:)

Creates an object of a specific material that the given geometric data shapes.

```
convenience init(engine: PHASEEngine, mesh: MDLMesh, materials: [PHASEMaterial])
```

## Parameters

`engine`

The object that controls this class’s associated audio output.

`mesh`

A collection of points that connect to form a shape.

`materials`

An array of objects that describe surface characteristics.

## Discussion

The framework assigns a material from the material array for every submesh in the mesh object. For example, PHASE infers that the first mesh is wooden if the first element of the material array is [`PHASEMaterialPreset.wood`](/documentation/PHASE/PHASEMaterialPreset/wood).

If the number of submeshes within the mesh is less than or equal to the material array count, each material indexes the corresponding element. If the number of submeshes is greater than the material array count, each material indexes the element at the element index modulo the material count.

The framework generates an error for empty material arrays or `nil` array entries.

---

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)