I have below PG where when camera intersect with mesh I am capturing it using BABYLON.ActionManager.OnIntersectionEnterTrigger https://playground.babylonjs.com/#NB9U03#1
I am using thin instances, so also enabled thinInstanceEnablePicking, But the issue is it doesn’t always trigger my event, if you move camera forward in PG, it will output in console.log when camera intersect with mesh but not with thin instances, but when you walk back it will work with thininstance but not with main mesh, I would like to always trigger OnIntersectionEnterTrigger whenever I am above those white meshes and thin instances.
Seems to be working for me. Note that you need to leave the mesh if you want the enter event to trigger again. Your meshes look like this (each mesh has a different color):
@RaananW If you keep moving forward as is in your image, when you are on first 3 meshes (first blue-red-green in your image ), those trigger events when you walk straight, but last 3 doesn’t trigger any event, and when you walk back last 3 are triggering event but not the first 3. please see this video of the issue, I write in console when it doesn’t trigger: Screen Recording 2021-01-28 at 3.26.53 PM.mov - Google Drive
This is because they are considered to be the same mesh. Notice what happens when you enable the bounding box on one of them - it shows both together. The inspector will also not show you any other instance. Thin instances are a wonderful way of achieving a sort of cloning, with some down sides.
It’s described here - Thin Instances | Babylon.js Documentation
If you want to achieve that, you will have to use instance meshes instead
Thanks @RaananW , I actually have learned all the thininstance stuff from @Evgeni_Popov and he actually did some PR’s too for some stuff which was not working so thought maybe he know some other trick , I admire your XR stuff, have been reading those… and once I start there I will definitely bug you more xD
Now I need to replace thininstance with instance in above PG, but not able to adjust properly X/Z position, I have to manually adjust X position in the loop with m.position.x = 122; https://playground.babylonjs.com/#NB9U03#4
if I try to set m.position.x = obj.position.x; it doesn’t work
how could I make it work properly without setting x position manually, like I am doing with thininstance PG? in my real project I also have rotationQuaternion which is creating issues.