Sie sind nicht angemeldet.

21

Freitag, 25. September 2009, 21:04

Hi viewinz,

Zitat

This works really well clockwise, and fades out smoothly as it's supposed to.. However counter-clockwise it disappears abruptly.
Nothing wrong on your code.... ;-) The problem comes from the test_hotspot_in_range action that is not right when a full 360 or -360 around are done...

After some tests (scraping a lot my head *tongue* ), I have modified the code to take into account full 360 around...
Here is an example to test the code:

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>


The modified test_hotspot_in_range action become like this:

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>

The added code are in line 4, 5, 8 and 9 .

I think there is no error...

Let me know. *smile*

Salut.

viewinz

Fortgeschrittener

Beiträge: 145

Wohnort: Wellington, New Zealand

Beruf: Trying to build an entire walkthrough of NZ for tourists

  • Nachricht senden

22

Samstag, 26. September 2009, 07:14

Works perfectly you are a star! *thumbsup*

AKSAN Bros (ULSAKS)

Fortgeschrittener

Beiträge: 192

Wohnort: Turkey

Beruf: 360 Software and Hardware Developing

  • Nachricht senden

23

Samstag, 10. Oktober 2009, 21:50

to Klaus

Hello we would like to make a system using this, but we want to use it not with all hotspots, only selected hotspots. How can we do this? And this code we use if you have so much poly hotspots it waits soo much time to work

<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]


viewinz

Fortgeschrittener

Beiträge: 145

Wohnort: Wellington, New Zealand

Beruf: Trying to build an entire walkthrough of NZ for tourists

  • Nachricht senden

24

Sonntag, 11. Oktober 2009, 07:51

you could maybe give the hotspots an additional variable, i.e. type and use an if statement in test_hotspot_in_range action to test for presence of this variable, and only carry out the action if that variable is there?

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

25

Sonntag, 8. November 2009, 13:57

Hi,

i have a few quesions...

I like only to have this behaviour on this hotspot... and i get an stack overload flash debug error..

Please Help *cry*

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>


Can anybody help me with this?

Thanx
Tuur *thumbsup*

26

Sonntag, 8. November 2009, 18:47

Hi,

in this case change the onviewchange event and call only the "test_hotspot_in_range" action with the name of the hotspot,

e.g.

Quellcode

1
<events onviewchange="test_hotspot_in_range(kopman_button);" />


best regards,
Klaus

27

Montag, 22. März 2010, 18:19

HI,

But for 3 hotspots? *wacko*
<events onviewchange="test_hotspot_in_range(hotspot1, hotspot2, hotspot3);" /> ???

Could you help me Please
Thanks

28

Montag, 22. März 2010, 21:20

Hi,

Try this:

Quellcode

1
2
3
<events onviewchange="	test_hotspot_in_range(hotspot1);
	 	 	test_hotspot_in_range(hotspot2);
	 	 	test_hotspot_in_range(hotspot3);" />


SAlut.

bulp

Fortgeschrittener

Beiträge: 390

Wohnort: Malaysia

  • Nachricht senden

29

Mittwoch, 24. März 2010, 14:52

this code works really great.. just how to set hotspot appear/visible only when onviewchange to the center of screen?..mean to set current code EDGE = CENTER or any location.... the current hotspot been set EDGE = LEFTTOP.. i dont know how to tweak it.. :)

30

Mittwoch, 4. Mai 2011, 09:18

Hi there...

and sorry for bringing up such an old thread.

I´ve tried michels suggestion but it did´nt work. This is how I got it to work:

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);
" />


BUT if I add all hotspots from a tour this way, than all hotspots are continously tested, even if they´re not in the active scene. And we´re talking here about 50 Hotspots! So here is my question:
How do I add only the hotspots from the active scene to the onviewchange-event? Is there a way to call an event directly inside a scene without making it globally active?

Thanks,
NUPSI

31

Mittwoch, 4. Mai 2011, 15:01

Is there a way to call an event directly inside a scene without making it globally active?


yes you can use all the evetns in each individual scene. they will over write the global ones if they do not match. just set the hotspots you want in the viewchange event. even if you list all the hotspots they most likey are not all being tested. they are being looked for but since hotspots are usually scene specific thus keep="false" they are not actually manipulated since they are not there. only the hotspots in teh scene will be found and adjusted. still better to just adjust for the ones you know are in the scene.

32

Samstag, 7. Mai 2011, 12:04

Thanks a lot for your help, VN2011

The problem here would be that if I load 10 Hotspots in Scene 1 into the onviewchange-event, they would still be in memory in Scene 2 and krpano would still look for them, because there is no way to tell events to been deleted after leaving a scene, or is there a way?

I did a test and the performance got worse and worse each time a scene were loaded, which kinda proofs that all hotspots still in the onviewchange-event and also tested :(

Sincerly,
Nupsi

33

Montag, 6. November 2017, 14:04

Sorry, for digging out this old threat ... I've tested the fade in/out action and it's working good so far ...

But what if I just want specific hotspots to have that fade in/out effects? What have to be altered to only effect "my" tagged hotspots?

Quellcode

1
<hotspot .... tag="mytag" ... />


Would be great if someone could help me out on this. Thanks

34

Dienstag, 7. November 2017, 12:43

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" ->

35

Dienstag, 7. November 2017, 13:59

Thanks a lot Umalo

Ähnliche Themen