Collision problem (bug?) with gltf mesh, without indexes

I seem to have a problem with camera collision detection with a mesh loaded as glb.

A glb/gltf mesh might not have indexes, just vertices. I that case the mesh is rendered like OpenGL draw array call. BabylonJS renders the mesh correctly, and it can also be picked, but collisions don’t seem to work.

I at least tried to track the code and ended in:

Collider.prototype._collide = function (trianglePlaneArray, pts, indices, indexStart, indexEnd, decal, hasMaterial, hostMesh) {

which expects the indices array. I did some quick testing by adding:
if (indices.length == 0){
for (var i = 0; i < pts.length; i += 3) {
var p1 = pts[i];
var p2 = pts[i+1];
var p3 = pts[i+2];
this._testTriangle(i, trianglePlaneArray, p3, p2, p1, hasMaterial, hostMesh);
}
}

which seems to activate collisions, but of course is not really correct,

Eero

pinging @RaananW

Hi @epa, sorry for a later reply!

That’s an interesting use case for collisions :slight_smile: Would you be able to provide me with a model to test on? will be very helpful in finding a solution for this