nicklockwood/Euclid

Loading a Euclid Mesh Directly into a RealityKit ModelEntity

Theophania opened this issue · 1 comments

First of all, thank you for the excellent work, this library is amazing and helped me a lot with my project!

I’ve got a question: I saw in some examples that a mesh from Euclid is loaded directly into a ModelEntity in RealityKit. But it looks like ModelEntity expects a MeshResource. I receive the error message: Cannot convert value of type 'Mesh' to expected argument type 'MeshResource'

let modelEntity = ModelEntity(mesh: euclidMesh)

Can I load a Euclid mesh directly into a RealityKit ModelEntity? Is there a conversion process required to turn a Euclid mesh into a MeshResource? Thank you.

@Theophania if you omit the mesh: argument name and just use:

let entity = try ModelEntity(euclidMesh)

then it should work.