pg: https://playground.babylonjs.com/#XCPP9Y#9466
Hey~ALL, It should be clarified that the reason for not registering click events to open it is that the actual situation is more complicated than pg. So I need to close plane and the ray caster without triggering it.
When the plane is hidden, it can be opened by clicking on the sphere.
https://playground.babylonjs.com/#XCPP9Y#9472
Looks like you had a bit of a ordering issue where the GUI observer was happening before the scene click. In order to fix this I simple create an additional variable to not check the ray if we already hit the GUI. We set it to true when we click down and false if we hit the GUI.
scene.onPointerDown = function setDown() {
checkRay = true;
}
Edit: In fact I just realized in an optimization we don’t even need to send the ray out if we hit the GUI:
4 Likes