I'm attempting to use flyout hotspots in a webvr, but am having difficulty closing them back their original state. When using the example code, it works great on desktop using the onclick method. But in vr, I cannot close the hotspot back to it's original location, because it's in a fixed position on the screen.
Can anyone please help provide a solution? Here's my code:
Code
<style name="flyoutimage" distorted="true" flying="0.0" backup_state="" backup_zorder="" flying_state="in" capture="false" onclick="flyout_hotspot();" /> <hotspot name="greeting" style="flyoutimage" distorted="true" url="img/greeting.png" zorder="1" ath="45" atv="54" ox="0" oy="0" scale="0.1" rx="-22.5" ry="-26.25" rz="-50.1" /> <!-- flyout hotspot actions --> <action name="flyout_hotspot"> for(set(i,0), i LT hotspot.count, inc(i), copy(hs, hotspot[get(i)]); if(hs.name != name AND hs.style == 'flyoutimage' AND (hs.flying_state == 'out' OR hs.flying_state == 'flyingout'), callwith(hs, flyout_hotspot() ); ); );
if(flying_state == 'flyingout', set(flying_state, 'flyingin'); , if(flying_state == 'flyingin', set(flying_state, 'flyingout'); ); );
if(flying_state == 'in', calc(backup_state, '0.0|' + rx + '|' + ry + '|' + rz + '|' + scale); copy(backup_zorder, zorder); set(flying_state, 'flyingout'); );
if(flying_state == 'out', set(flying_state, 'flyingin'); );
if(flying_state == 'flyingout', set(zorder, 99); tween(flying|rx|ry|rz|scale, '1.0|0.0|0.0|0.0|1.0', 0.5, default, set(flying_state,'out'); set(capture,true); ); );
if(flying_state == 'flyingin', sub(zorder,1); set(capture,false); tween(flying|rx|ry|rz|scale, get(backup_state), 0.5, default, set(flying_state,'in'); copy(zorder,backup_zorder); ); ); </action>