The glTF mesh in the array MUST be a trimesh to work, and should be made of only one glTF mesh primitive (one surface).
Currently in the thirdroom-unity-exporter we export colliders that point to meshes with multiple primitives. This is mostly due to it being easy to call exporter.ExportMesh() and get back a mesh id for the collider's trimesh. That function will return a mesh with multiple primitives if the source mesh has multiple primitives. In the assets we have purchased on the Unity Asset Store, that is often how they are set up. Implementing this in our engine with Rapier basically involves adding multiple trimesh colliders to a single rigid body (compound collider) and then it "just works". I think it's a bit constraining to only allow a single primitive per trimesh collider in the spec.
We've gone back and forth on this issue multiple times, but I think I'm now on the side of supporting multiple primitives per trimesh/hull. It'll make our implementations easier to build (no special logic to export a collider's trimesh vs a mesh).
If it's absolutely vital to have a single primitive per trimesh, then we need to change our exporter such that it exports multiple nodes under the rigidbody and is used as a compound collider this way. I think this is an unnecessary step though. If we're supporting compound colliders already, why not support multiple primitives per trimesh?
Can you provide an example file that uses multiple mesh primitives in one collider? I guess I can just implement this in Godot by having it merge the meshes together and then use that to generate a collider.
Currently. the OMI_collider spec states:
Currently in the thirdroom-unity-exporter we export colliders that point to meshes with multiple primitives. This is mostly due to it being easy to call
exporter.ExportMesh()
and get back a mesh id for the collider's trimesh. That function will return a mesh with multiple primitives if the source mesh has multiple primitives. In the assets we have purchased on the Unity Asset Store, that is often how they are set up. Implementing this in our engine with Rapier basically involves adding multiple trimesh colliders to a single rigid body (compound collider) and then it "just works". I think it's a bit constraining to only allow a single primitive per trimesh collider in the spec.We've gone back and forth on this issue multiple times, but I think I'm now on the side of supporting multiple primitives per trimesh/hull. It'll make our implementations easier to build (no special logic to export a collider's trimesh vs a mesh).
If it's absolutely vital to have a single primitive per trimesh, then we need to change our exporter such that it exports multiple nodes under the rigidbody and is used as a compound collider this way. I think this is an unnecessary step though. If we're supporting compound colliders already, why not support multiple primitives per trimesh?