Hover work without GUI but dont work with (cameraGUI obligatory for dont double GUI on mini camera)

code: (click on corner right for look code)
https://codepen.io/joffrey-courty/pen/xxJvgVL

Hi,
Hope you are well.
I believe this is partly my bad and you nearly fixed it by changing the order of attaching the cameras.
A second part comes from the layerMasks (order).
Finally, to avoid any potential later issue if you keep adding controls on top of the scene comes from that some GUI controls act as a ‘pointerBlocker’ (typically the textBlock). These controls by default block all interactions with scene meshes no matter if they are in front or behind the GUI (visually or in the hierarchy).

So, the fix is ez and comes in two parts:

  1. On line 1374, Change the order for activeCameras to:

scene.activeCameras = [minicamera, cameramain, cameraGUI];

  1. On line 1138, Set the layerMask of the advancedDynamicTexture and the ‘cameraGUI’ to

cameraGUI.layerMask = 0xFFFFFFF0;

2a) On line 1144, Set the main (scene) camera layerMask to:

cameramain.layerMask = 0x10000000;

  1. (optional). To make sure none of your controls act as a pointerBlocker, you can either set them manually on the control

control.isPointerBlocker = false;

or for all of 'em you could do something like:

advancedTexture.getDescendants().forEach(function(control) {
control.isPointerBlocker = false;
});

Hope this helps and sry for the confusion if I did simply answer your previous without anticipating this next coming issue (which I should have because it was obvious) :shushing_face:
Meanwhile, have a great weekend :sunglasses:

2 Likes

perfect! :DDD

u are a boss! :hugs:

just explain me why : “0x10000000” or “0xFFFFFFF0”, and not 0 1 2 ? i’m curious

It’s basically because of the way layers are used for rendering in BJS. The result of the AND operation determines if a layer is visible or not (a mesh by the camera but also other processes, such as particles or post and of course, the GUI layer). You can actually use 0,1,2,3 (which will fill the empty 4 bits left in the default value as to ease the operation) and then you can actually use any value up to 4294967295 as an input value. BUT it is the result of the AND operation that will flag if the layer is visible or not. Therefor, it’s easier to use hexadecimal.
In most cases, it’s enough to do that. But knowing of the correct input value, I’d say it’s better to use straight a hexadecimal value.
As for the detailed explanation, you can find it here.
Meanwhile, have a great day :sunglasses:

1 Like