Mutliple cameras affect billboard meshes

Hello, I’m currently working on a minimap implementation. I’ve added a second camera and tweaked the viewport of it and it’s working fine, but now for some reason it’s affecting my mesh picking.
I have a bunch of meshes in the scene, which I need to be able to select. I was doing that using scene.createPickingRay but passing the appropriate camera from the active cameras array.

It’s working fine, with one exception. Meshes which have the billboardMode set to BILLBOARDMODE_ALL don’t seem to work properly. If I remove the mode they get picked fine, but I need them to always face the camera.

Can anyone explain why this is happening?

Thanks in advance

It looks like a bug to me. Could you share a repro in the playground ?

Have you tried to set the scene.cameraToUseForPointers property?

Yes, I have set those already, unfortunately it’s still something on my end as when I tried to reproduce the bug in a playground it worked fine. So now I’m trying to find the issue as the picking works fine with everything else in the scene, so I assume it’s something specific to those objects.

I use MeshBuilder.CreateDisc function to generate the meshes, although I don’t think that’s relevant to this issue.

I appreciate the help

Hey, I managed to reproduce my issue. Please let me know what you think. Thanks!

The issue for me is that the hit detection doesn’t find the mesh, but seems to work fine with the other planes.

Thanks for the repro! Let me take a look at this :slight_smile:

@carolhmj If you want a simpler repro:

Not using the billboard mode or using it but with a sphere make the PG work, it it helps.

2 Likes

PR here! Fix hit detection in a multi-cam scenario with billboarded meshes. by carolhmj · Pull Request #13471 · BabylonJS/Babylon.js (github.com)

3 Likes