PHASE Engine crashing when creating occluders from some MDLMeshes

hi there,

i'm running into issues when creating occluders from arbitrary MDLMeshes (i.e. 3d models i create in app and then turn into MDLMeshes, rather than MDLMesh.newBox() etc). some meshes work fine, others hit an assert deep in the PHASE c++ code. i've tested on simulator and iPhone 12 (iOS16 and now iOS17 beta 3).

i've tried to figure out if there's some kind of pattern to which meshes work and which don't, but haven't been able to find one. note that using the build in MDLMesh primitives works fine.

the assert is:

Assertion failed: (voxelIndex < level.mVoxels.Count()), function AddBuilderVoxelToSubtree, file GeoVoxelTree.cpp, line 188.

the code is:

    func createOccluder(from meshes: [MDLMesh], at transform: Transform, preset: PHASEMaterialPreset) throws -> PHASEOccluder {
        guard let engine else {
            throw "No engine"
        }

        print("audio meshes: \(meshes)")

        let material = PHASEMaterial(engine: engine, preset: preset)

        var shapes: [PHASEShape] = []
        for (_, mesh) in meshes.enumerated() {
            let meshShape = PHASEShape(engine: engine, mesh: mesh)

            for element in meshShape.elements {
                element.material = material
            }
            
            shapes.append(meshShape)
        }

        let occluder = PHASEOccluder(engine: engine, shapes: shapes)

        occluder.worldTransform = transform.matrix

        try engine.rootObject.addChild(occluder)

        return occluder
    }

the assert happens with:

let occluder = PHASEOccluder(engine: engine, shapes: shapes)

any ideas on what could be going on here?

cheers,

Mike

screenshots of callstack etc: