A high-level representation of a collection of vertices and edges that define a shape used for simulating reverb.
Use a `ReverbMeshResource` to describe the acoustic geometry of your scene. Create one from geometric
primitives, custom vertex data, or an existing ``MeshResource``:
```swift
// From a geometric primitive:
let room = ReverbMeshResource.shoebox(size: [4, 3, 5])
// From custom vertex data:
let mesh = try ReverbMeshResource(
positions: myPositions,
triangleIndices: myIndices,
materials: perFaceMaterialIndices
)
// From an existing mesh resource:
let mesh = try ReverbMeshResource(from: myVisualMesh)
```
Pair a reverb mesh with ``Audio/Material`` values and set a ``ReverbComponent`` on an entity
to activate simulated reverb:
```swift
let reverb: Reverb = .simulated(mesh: room, materials: [.concrete, .carpet])
entity.components.set(ReverbComponent(reverb: reverb))
```
- Note: Reverb meshes perform best with fewer than 1000 polygons.
Members (4)
static · iOS 27.0+
box
TypeScript
static box(size: SDKHandle): ReverbMeshResource
Swift declaration
static func box(size: SIMD3<Float>) -> Self
Creates a box mesh with vertices positioned such that the origin is at the center,
with faces oriented outward.
Use this factory method for objects that are *in* the scene rather than defining
the scene, or when combining multiple reverb meshes to define a space
(for example, separate entities for the floor, ceiling, and walls of a room).
- Parameter size: The width, height, and depth of the box, in meters.
Creates a new rectangle reverb mesh with the specified dimensions in the entity's xz-plane.
- Parameters:
- width: The width of the plane along the x-axis, in meters.
- depth: The depth of the plane along the z-axis, in meters.
Creates a box mesh with the vertices positioned such that the bottom surface is at y=0,
with faces oriented inward.
Use this factory method for objects that *define* the scene rather than objects within it —
for example, the enclosing walls, floor, and ceiling of a room.
```swift
let room = ReverbMeshResource.shoebox(size: [4, 3, 5])
```
- Parameter size: The width, height, and depth of the box, in meters.
Creates a reverb mesh resource from a list of positions, triangle indices, and material indices.
Use this initializer when you have precise control over the geometry:
```swift
let mesh = try ReverbMeshResource(
positions: myPositions,
triangleIndices: myIndices,
materials: perFaceMaterialIndices
)
```
- Parameters:
- positions: The vertex positions of the mesh.
- triangleIndices: The triangle indices that reference positions in the `positions` array.
- materials: An array of material indices, one per triangle, that map each face to a
material in the ``Audio/Material`` array provided to ``Reverb/simulated(mesh:materials:)``.