Mesh occluded or not?

Hi.

Well, how to detect if the mesh is occluded or not by other mesh.

Basically I need to know when the sphere is behind the cube, and when it is visible to camera.

The best answer is probably this one:

Hmm. Saw that, I just tried it out, and it doesn’t work for some reason.

What I want to do is to hide the GUI element linked with mesh if the mesh is occluded (I am using invisible boxes as anchor meshes (and yes I made them visible during testing this))

This is the project where I want to do it. Is there another approach to this issue?

What is not working?
You mean the PG is not working?

Hey Deltakosh. I’ve had some complex implementation, I made it work after some tweaking, but for my purposes it didn’t turn out to be the proper solution. So I switched to

BABYLON.GUI.AdvancedDynamicTexture.CreateForMesh()
instead of
BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI()

Created planes on the hotspot locations, applied advancedDynamicTexture, and set them to billboard mode so the always face the camera. That way, my hotspots get occluded when the mesh is occluded.

I will mark your answer as solution though, as that approach basically worked, and can be used in my solution.

Thank you. I appreciate your help.

1 Like