SolidParticleSystem Picking(maybe a bug)

I think it is a bug but I’m not sure.
If you try to pick a extrudeshape you’ll get an error.

I went through the source code. In solidParticleSystem.pickedParticle, faceId comes from the index of sps-mesh, while pickedBySubMesh may be splited becauseof multi materials of sps. I think faceId should subtract the submeshes’ faces before.

That’s how I “fix” it now.

sps.__proto__.pickedParticle = function(pickingInfo) {
    if (pickingInfo.hit) {
        const subMesh = pickingInfo.subMeshId;
        let faceId = pickingInfo.faceId;
        const picked = this.pickedBySubMesh;
        for (let i = 0; i < subMesh; i++) {
            faceId -= picked[i].length;
        if (picked[subMesh] && picked[subMesh][faceId]) {
            return picked[subMesh][faceId];
    return null;

Pinging @jerome :wink:

The same with

1 Like