Hi,
We would like to show a button on the object if it is visible on the screen. It’d be okay even if it is partially visible.
One approach that we came up with is to raycast to the bounding box center of that object and check if it is hidden by anything. But sometimes, when mesh is torus for example, the ray goes through the center and we don’t see the button on that object.
The button currently is absolutely positioned HTML button (by projecting the bounding box center onto camera).
One approach that we are thinking of is to raycast to a random vertex of the mesh, but that would also not give us satisfying results.
Another approach is modify raycaster so that it checks if the ray intersects the bounding box, not the object itself, but I envision scenarios where it will fail.
The only reliable way I think is to check the depth buffer but there is no way to co-relate it back to the object.
Can someone please help us here?