Nothing wrong on your code....
Zitat
This works really well clockwise, and fades out smoothly as it's supposed to.. However counter-clockwise it disappears abruptly.
The problem comes from the test_hotspot_in_range action that is not right when a full 360 or -360 around are done...
), I have modified the code to take into account full 360 around...|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
<krpano version="1.0.7"> <!-- use the editor for moving,rotating,scaling hotspots --> <plugin name="editor" url="%SWFPATH%/plugins/editor.swf" /> <plugin name="options" url="%SWFPATH%/plugins/options.swf" /> <view fisheyefovlink="1.5" /> <preview type="grid(cube,32,32,256,0x000000,0x778899,0x000000);" details="8" /> <events onviewchange="show_hotspots_in_range()" /> <action name="show_hotspots_in_range"> set(i,0); loop_hotspots(0); </action> <action name="loop_hotspots"> test_hotspot_in_range(get(hotspot[%1].name)); inc(i); if (i LT hotspot.count, loop_hotspots( get(i) ) ); </action> <action name="test_hotspot_in_range"> sub(hdistance, view.hlookat, hotspot[%1].ath); mod(hdistance,hdistance,360); if(hdistance GT 180, sub(hdistance,hdistance,360)); if(hdistance LT -180, add(hdistance,hdistance,360)); sub(vdistance, view.vlookat, hotspot[%1].atv); mod(vdistance,vdistance,360); if(vdistance GT 180, sub(vdistance,vdistance,360)); if(vdistance LT -180, add(vdistance,vdistance,360)); if(hdistance LT 0, mul(hdistance,hdistance,-1)); if(vdistance LT 0, mul(vdistance,vdistance,-1)); if(hdistance GT 25, set(hdistance,25) ); if(vdistance GT 25, set(vdistance,25) ); div(hdistance,hdistance,25); div(vdistance,vdistance,25); add(distance2,hdistance,vdistance); sub(hotspot[%1].alpha,1.0,distance2); if(hotspot[%1].alpha LT 0.2, set(hotspot[%1].alpha,0.2) ); </action> <hotspot name="hs1" keep="false" visible="true" enabled="true" handcursor="true" capture="true" children="true" zorder="0" fillcolor ="0xffffff" fillalpha ="0.40" borderwidth ="2.0" bordercolor ="0xffffff" borderalpha ="0.50" fillcolorhover="0xffffff" fillalphahover="0.40" borderwidthhover="4.0" bordercolorhover="0xffffff" borderalphahover="0.80" fadeintime="0.150" fadeouttime="0.300" fadeincurve="1.100" fadeoutcurve="0.700" onover="" onhover="set(hotspot[hs1].alpha,1)" onout="action(show_hotspots_in_range);" ondown="" onup="" onclick="" flying="0" ath="0" atv="0" > <point ath="-10" atv="-10" /> <point ath="-10" atv="10" /> <point ath="10" atv=" 10" /> <point ath="10" atv="-10" /> </hotspot> </krpano> |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<action name="test_hotspot_in_range"> sub(hdistance, view.hlookat, hotspot[%1].ath); mod(hdistance,hdistance,360); if(hdistance GT 180, sub(hdistance,hdistance,360)); if(hdistance LT -180, add(hdistance,hdistance,360)); sub(vdistance, view.vlookat, hotspot[%1].atv); mod(vdistance,vdistance,360); if(vdistance GT 180, sub(vdistance,vdistance,360)); if(vdistance LT -180, add(vdistance,vdistance,360)); if(hdistance LT 0, mul(hdistance,hdistance,-1)); if(vdistance LT 0, mul(vdistance,vdistance,-1)); if(hdistance GT 25, set(hdistance,25) ); if(vdistance GT 25, set(vdistance,25) ); div(hdistance,hdistance,25); div(vdistance,vdistance,25); add(distance2,hdistance,vdistance); sub(hotspot[%1].alpha,1.0,distance2); if(hotspot[%1].alpha LT 0.2, set(hotspot[%1].alpha,0.2) ); </action> |
Benutzerinformationen überspringen
Wohnort: Wellington, New Zealand
Beruf: Trying to build an entire walkthrough of NZ for tourists
<action name="show_hotspots_in_range">
set(i,0);
loop_hotspots(0);
</action>
<action name="loop_hotspots">
test_hotspot_in_range(get(hotspot[%1].name));
inc(i);
if (i LT hotspot.count, loop_hotspots( get(i) ) );
</action>
<action name="test_hotspot_in_range">
sub(hdistance, view.hlookat, hotspot[%1].ath);
mod(hdistance,hdistance,360);
sub(vdistance, view.vlookat, hotspot[%1].atv);
mod(vdistance,vdistance,360);
if(hdistance LT 0, mul(hdistance,hdistance,-1));
if(vdistance LT 0, mul(vdistance,vdistance,-1));
if(hdistance GT 25, set(hdistance,25) );
if(vdistance GT 25, set(vdistance,25) );
div(hdistance,hdistance,25);
div(vdistance,vdistance,25);
add(distance2,hdistance,vdistance);
sub(hotspot[%1].alpha,1.0,distance2);
if(hotspot[%1].alpha LT 0.2, set(hotspot[%1].alpha,0.2) );
</action>
[/code]
Benutzerinformationen überspringen
Wohnort: Wellington, New Zealand
Beruf: Trying to build an entire walkthrough of NZ for tourists
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
<hotspot name="kopman_button"
keep="false" visible="true" enabled="false" handcursor="true" capture="true" children="true"
url="../P/buttons/kopman_1.png"
scale="0.35549938091891264"
zoom="true"
zorder="0"
ath="0.9449165844618079" atv="27.91916741118999">
</hotspot>
<events onviewchange="show_hotspots_in_range()"
/>
<action name="show_hotspots_in_range">
set(i,0);
loop_hotspots(0);
</action>
<action name="loop_hotspots">
test_hotspot_in_range(get(hotspot[%1].name));
inc(i);
if (i LT hotspot.count, loop_hotspots( get(i) ));
</action>
<action name="test_hotspot_in_range">
sub(hdistance, view.hlookat, hotspot[%1].ath);
mod(hdistance,hdistance,360);
if(hdistance GT 180, sub(hdistance,hdistance,360));
if(hdistance LT -180, add(hdistance,hdistance,360));
sub(vdistance, view.vlookat, hotspot[%1].atv);
mod(vdistance,vdistance,360);
if(vdistance GT 180, sub(vdistance,vdistance,360));
if(vdistance LT -180, add(vdistance,vdistance,360));
if(hdistance LT 0, mul(hdistance,hdistance,-1));
if(vdistance LT 0, mul(vdistance,vdistance,-1));
if(hdistance GT 25, set(hdistance,25) );
if(vdistance GT 25, set(vdistance,25) );
div(hdistance,hdistance,25);
div(vdistance,vdistance,25);
add(distance2,hdistance,vdistance);
sub(hotspot[%1].alpha,1.0,distance2);
if(hotspot[%1].alpha LT 0.1, set(hotspot[%1].alpha,0.0) );
</action>
|
: https://pame.virtualtuur.com|
|
Quellcode |
1 2 3 4 5 |
<events onviewchange="test_hotspot_in_range(hotspot1); test_hotspot_in_range(hotspot2); test_hotspot_in_range(hotspot3); test_hotspot_in_range(hotspot4); " /> |
Is there a way to call an event directly inside a scene without making it globally active?
|
|
Quellcode |
1 |
<hotspot .... tag="mytag" ... /> |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 |
<action name="loop_hotspots">
if (hotspot[%1].tag=='toggle_me',
test_hotspot_in_range(get(hotspot[%1].name));
);
inc(i);
if (i LT hotspot.count, loop_hotspots( get(i) ) );
</action>
<hotspot name="hs_1".... tag="toggle_me" ->
<hotspot name="hs_2".... ->
<hotspot name="hs_3".... ->
<hotspot name="hs_4".... tag="toggle_me" ->
|