I believe an update between October 2019 and now has broken Raycasting on any GLB/GLTF objects that have SkinnedMesh objects in them

So yeah, this one is a seriously weird one. I’ve laid it all out in a Sandbox here and I’d love to get some input on what could be happening here.

TL:DR;
I wrote a tutorial back in October, the part that others are failing on now is that Raycasting will no longer find an object as long as it has Bones and/or a SkinnedMesh object. I thought this would be an easy debug can I don’t know where in the pipeline it’s breaking down. Whether it’s Blenders GLB export, or Three, however different versions of Three don’t appear to make a difference as far as I can tell.


In the Sandbox there are 3 GLB files. There’s a low poly character that has bones and one that doesn’t You will see in the console when you click on the character that the one with the bones doesn’t respond to the raycasting.

However, the third file is a GLB that I output in October, which correctly responds to the raycasting.

What confuses me is that putting the two Scenes objects side by side, the makeup seems identical:

I’d love to help this guy out and at this point I’m stumped. Any ideas?

Maybe related:

Notice that raycasting with SkinnedMesh is still problematic since the engine is still unable to compute a proper AABB enclosing the maximum extend of the animated geometry. That means raycasting might still fail unless you manually define the AABB large enough.

To clarify: Before the above PR was merged, raycasting with SkinnedMesh was in fact not supported.

2 Likes

This issue should be fixed starting with r153.

Proper bounding volume computation for skinned meshes was added with r151 and honored by ray casting since r153.

2 Likes

I’m using r159 and from what I can tell raycasting still doesn’t work with a skinned mesh. I’m loading in this test model glTF-Sample-Models/2.0/SimpleSkin/glTF-Embedded/SimpleSkin.gltf at d7a3cc8e51d7c573771ae77a57f16b0662a905c6 · KhronosGroup/glTF-Sample-Models · GitHub and it can only hit the mesh when I raycast toward points inside the yellow box (which is static and doesn’t cover the whole mesh). In r129 the same problem exists but the area where raycasting works at least covers the mesh on the initial frame of the animation instead of half in r159. Is this an issue with gltfs specifically?