I would like to trigger an event like this tween(plugin[guide4].y,-200,3)"
when you pass for example hlookat 90, 180 etc.
Is this possible with a simple code? I can not find anything about it.
Hans
I would like to trigger an event like this tween(plugin[guide4].y,-200,3)"
when you pass for example hlookat 90, 180 etc.
Is this possible with a simple code? I can not find anything about it.
Hans
Hi,
directly triggering an event when reaching a specific point isn't possible, but you can use the onviewchange event and do there specific checks...
e.g. here a a one-time check if hlookat is greater then 90:
<events name="viewtest" onviewchange="if(view.hlookat GT 90, events.removearrayitem(viewtest); trace(...do your stuff here...); );" />
one-time because after the condition is the first time true, the event itself will be removed and the custom code executed (the trace in this example),
if an event should trigger constantly when reaching a certain range, it would be more complicated - an additional variable, that stores if inside or outside the range, must be used,
e.g. this code checks when entering the hlookat range 90-180 and when leaving it:
<events name="rangeevent" onviewchange="rangeevent();" />
<action name="rangeevent">
set(inside,false);
if(view.hlookat GT 90, if(view.hlookat LT 180, set(inside,true); ); );
if(lasttime_inside === null, copy(lasttime_inside,inside));
if(lasttime_inside != inside,
if(inside,
trace('you have entered the range 90 to 180');
,
trace('you have leaved the range 90 to 180');
);
copy(lasttime_inside,inside);
);
</action>
Display More
best regards,
Klaus
Display MoreHi,
directly triggering an event when reaching a specific point isn't possible, but you can use the onviewchange event and do there specific checks...
e.g. here a a one-time check if hlookat is greater then 90:
Code<events name="viewtest" onviewchange="if(view.hlookat GT 90, events.removearrayitem(viewtest); trace(...do your stuff here...); );" />
one-time because after the condition is the first time true, the event itself will be removed and the custom code executed (the trace in this example),if an event should trigger constantly when reaching a certain range, it would be more complicated - an additional variable, that stores if inside or outside the range, must be used,
e.g. this code checks when entering the hlookat range 90-180 and when leaving it:
Code Display More<events name="rangeevent" onviewchange="rangeevent();" /> <action name="rangeevent"> set(inside,false); if(view.hlookat GT 90, if(view.hlookat LT 180, set(inside,true); ); ); if(lasttime_inside === null, copy(lasttime_inside,inside)); if(lasttime_inside != inside, if(inside, trace('you have entered the range 90 to 180'); , trace('you have leaved the range 90 to 180'); ); copy(lasttime_inside,inside); ); </action>
best regards,
Klaus
Hi Klaus,
I have been browsing the forums looking for an option like this to fix a problem. I too need a way to call an action when the user passing a certain viewpoint in the tour. The problem with this "continuous code version" is when the user passes the point, and continues spinning the tour in the same direction, the view.hlookat value continues to build towards infinity (so long as the user continues moving one direction). So the point in the scene we need a trigger, is gone.
I have a daytime/nighttime transition using 1 scene. Then i have 6 cubeface hotspots in the scene. So the scene starts as day, then switches to night, back and forth. I have yet to figure a code that will allow for continues transition at a heading say 0-1 degrees (view.hlookat = 0-1) when the tour spins only 1 direction.
Can you recommend a solution?
<krpano version="1.16" onstart="showlog(); set(counter, 0); startup();">
<events onviewchange="transition();" />
<action name="transition">
if(counter == 0,
if(view.hlookat GE 0,
if(view.hlookat LT 1.0,
delayedcall(1.0, changetonight(); );
);
);
);
if(counter == 1,
if(view.hlookat GE 0,
if(view.hlookat LT 1.0,
delayedcall(1.0, changetoday(); );
);
);
);
</action>
<action name="changetonight">
set(counter, 1); if(counter == 1, stopall(););
for(set(i, 1), i LE 6, inc(i),
txtadd(night, 'hot_', get(i));
set(hotspot[get(night)].visible, true);
tween(hotspot[get(night)].alpha, 1.0, 0.3, linear);
);
trace(Its Night);
</action>
<action name="changetoday">
set(counter, 0); if(counter == 0, stopall(););
for(set(i, 1), i LE 6, inc(i),
txtadd(day, 'hot_', get(i));
set(hotspot[get(day)].visible, true);
tween(hotspot[get(day)].alpha, 0.0, 0.3, linear);
);
trace(Its Day);
</action>
<action name="startup">
loadscene(scene_day, null, MERGE);
</action>
<scene name="scene_day" title="day" onstart="" thumburl="panos/day.tiles/thumb.jpg" lat="" lng="" heading="">
<view hlookat="-1" vlookat="0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />
<preview url="panos/day.tiles/preview.jpg" />
<image>
<cube url="panos/day.tiles/pano_%s.jpg" />
<mobile>
<cube url="panos/day.tiles/mobile_%s.jpg" />
</mobile>
</image>
<style name="cubeface" width="1002" height="1002" distorted="true" enabled="false" pixelhittest="true" preload="true" visible="false" alpha="0.0" />
<hotspot name="hot_1" style="cubeface" url="panos/night.tiles/pano_l.jpg" ath="-90" atv="0" zorder="2" />
<hotspot name="hot_2" style="cubeface" url="panos/night.tiles/pano_f.jpg" ath="0" atv="0" zorder="2" />
<hotspot name="hot_3" style="cubeface" url="panos/night.tiles/pano_r.jpg" ath="+90" atv="0" zorder="2" />
<hotspot name="hot_4" style="cubeface" url="panos/night.tiles/pano_b.jpg" ath="+180" atv="0" zorder="2" />
<hotspot name="hot_5" style="cubeface" url="panos/night.tiles/pano_u.jpg" ath="0" atv="-90" zorder="2" />
<hotspot name="hot_6" style="cubeface" url="panos/night.tiles/pano_d.jpg" ath="0" atv="+90" zorder="2" />
</scene>
</krpano>
Display More
Don’t have an account yet? Register yourself now and be a part of our community!