You are not logged in.

1

Wednesday, February 10th 2010, 3:47pm

compass example for landscape panos

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!


Source code

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
<!--#######################################-->
<!------------- 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>
best regards from www.PanAustria.com

2

Wednesday, February 10th 2010, 9:07pm

*w00t* Thanks a lot, good compass realisation.

David
Istanbul virtual tour creation : www.vizyon360.com

VN2009

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

3

Wednesday, February 10th 2010, 9:46pm

that compass kicks much ass! thanks for sharing!

edit: went to give this a try. realized there were no graphics. came here to look and found that you are not willing to share the graphics to make it work. understandable but disappointing.

This post has been edited 1 times, last edit by "VN2009" (Feb 11th 2010, 2:08am)


Phil

Trainee

Posts: 97

Location: Texas

  • Send private message

4

Tuesday, February 23rd 2010, 8:17pm

The link doesn't work in the first post. Where's an example of this new compass?

Phil

6

Tuesday, February 23rd 2010, 9:46pm

you can also followthe link (http://buckligewelt.panaustria.at) directly to the tour example showing the compass :-)
best regards from www.PanAustria.com