After loading the 3D object using a depthmap, I placed polygon hotspots on top of it.
The code for creating the hotspot is below:
Code
<hotspot name="hs_polygon"
polyline="false"
fillcolor="0xF09B59"
fillalpha="0.5"
borderalpha="0.0"
torigin="world"
twosided="true"
depthbuffer="true"
depthwrite="true"
onover="set(fillalpha, 0.8)"
onout="set(fillalpha, 0.5)"
>
<point x="-1.3024" y="-19.981" z="-9.8774"/>
<point x="-1.9718" y="-19.934" z="-20.177"/>
<point x="-2.0071" y="-1.7039" z="-20.117"/>
<point x="-1.183" y="-1.6586" z="-9.8118"/>
<point x="-1.3024" y="-19.981" z="-9.8774"/>
</hotspot>
Display More
After setting depthbuffer to true, I was able to hide the hotspot behind the 3d object.
However, mouse events still occur even though the hotspot is not visible because it is obscured by a 3D object.
depthmap with polygon hotspot
youtu.be
[SOLVED]
It was solved by setting hittest on depthmap to true.
Code
<image>
<depthmap
...
hittest="true"
...
/>
</image>
<hotspot name="hs_polygon"
polyline="false"
fillcolor="0xF09B59"
fillalpha="0.5"
borderalpha="0.0"
torigin="world"
twosided="true"
depthbuffer="true"
depthwrite="true"
onover="set(fillalpha, 0.8)"
onout="set(fillalpha, 0.5)"
onclick="trace('clicked')"
>
<point x="-1.3024" y="-19.981" z="-9.8774"/>
<point x="-1.9718" y="-19.934" z="-20.177"/>
<point x="-2.0071" y="-1.7039" z="-20.117"/>
<point x="-1.183" y="-1.6586" z="-9.8118"/>
<point x="-1.3024" y="-19.981" z="-9.8774"/>
</hotspot>
Display More