Hi everybody!
Tuur asked me for the compass in this thread.<-- you can see the working compass there.
So i want to share this code to you - maybe you will use it or have ideas to optimize and perform this thing (it is not perfect, but works fine for its reason...).
MANY(!!) thanks to Klaus - for his really cool product and for answering a lot(!) of questions i asked during the development of my project (see thread above) the last couple of month.
!! THANK YOU !!
Here is my compass (of course you have to make your own graphics...):
... is a little bit tricky:
1) there is a pane "cPane" that holds all components and it is their parent of course
2) the white compass shade (behind the letters) "compassRing" is nonrotating but needs to be masked out (mask="compassMask")
3) the letters itself (rotating with viewchange) need to be masked too
(mask="compassMask1"); it is the same mask as above but one plugin used
for masking only can mask ONE other plugin so you have to gen a 2nd
plugin with the same url to mask sth else with the same graf mask...
4) to "north" the view i made an action name="norden"; it is not
optimized (even bugy) - because if you turn around twice the pano and
the click to "north" it also turns back twice(!) - i know this could be
solved using the "mod(..)"-function, but time...
5) to get the compass follow the view you of course have to define a ´
onviewchange="viewchange()" ´ somewhere in your events-node and then
have a corresponding action as "viewchange" below. Not all the tours in
this project do have a compass but they do use the same code modules,
so i asked for existance of the compass within this action...
6) last but NOT LEAST i had to initiate the compass (set the
initrotate of the plugin compass) with an action that fires for every
scene-load, corresponding to its view and the distance (degrees) to the
north; therefore (for 115 panos this was work too) i had to measure
this distance and store it somewhere...
Hope it helps!
<!--#######################################-->
<!------------- COMPASS ---------------->
<!--#######################################-->
<plugin name="cPane"
parent="bPane"
url="%BASEDIR%gfx/paTrsp8x8.png"
ox="-50"
oy="-30"
keep="true"
align="bottomright"
zorder="24"
/>
<plugin name="compassRing"
parent="cPane"
url="%BASEDIR%gfx/CompassRing.png"
keep="true"
alpha="0.8"
edge="center"
scale="0.40"
zorder="26"
mask="compassMask"
/>
<plugin name="compass"
parent="cPane"
url="%BASEDIR%gfx/CompassLett.png"
keep="true"
alpha="0.9"
edge="center"
scale="0.40"
initrotate="0"
rotate="0.0"
zorder="27"
mask="compassMask1"
onclick="norden()"
onhover="showtext(Klick nordet Panorama..., buttonstyle);"
/>
<plugin name="compassMask"
parent="cPane"
url="%BASEDIR%gfx/c_mask.png"
edge="center"
keep="true"
scale="0.40"
/>
<plugin name="compassMask1"
parent="cPane"
edge="center"
url="%BASEDIR%gfx/c_mask.png"
keep="true"
scale="0.40"
/>
<action name="viewchange">
if(plugin[compass].name == compass, sub(plugin[compass].rotate,plugin[compass].initrotate, get(view.hlookat)));
</action>
<action name="norden">
set(control.usercontrol, off);
tween(view.fov, get(initfov), distance(100,1), smooth,
tween(view.hlookat, get(plugin[compass].initrotate),distance(360,1),EaseInOutQuad,
tween(view.vlookat, 0,distance(90,2),EaseInOutQuad, set(control.usercontrol, all)););
);
</action>
Alles anzeigen