Sie sind nicht angemeldet.

  • »jeromebg« ist der Autor dieses Themas

Beiträge: 1 120

Wohnort: Angers - France

Beruf: 360 experiences creator

  • Nachricht senden

1

Donnerstag, 20. August 2015, 12:15

getlooktodistance smaller value ?

Hi,
Using getlooktodistance to select a hotspot when middle of screen is great, but if you have more than one hotspot in the area it's a problem for using onover & onout if you want only one to be activated (the nearest one from the middle)

Klaus code is :

Quellcode

1
2
3
4
5
6
7
8
9
10
<action name="testhotspots">
    for(set(i,0), i LT hotspot.count, inc(i),
        getlooktodistance(d, hotspot[get(i)].ath, hotspot[get(i)].atv);
        if(d LT 10,
            highlight_hotspot(get(i), get(hotspot[get(i)].name));
          ,
            background_hotspot(get(i), get(hotspot[get(i)].name));
          );
      );
</action>


Is there a way to check witch one is the nearest to call onover on this one and onout and all the other ones ?

THX !!!!

2

Donnerstag, 20. August 2015, 15:40

Hi,

you would need to loop through all hotspots and remember the nearest distance.

Here an example (untested):

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<action name="testhotspots">
    set(nearest_hs_i, -1);
    set(nearest_hs_d, 10000);
    
    for(set(i,0), i LT hotspot.count, inc(i),
        getlooktodistance(d, hotspot[get(i)].ath, hotspot[get(i)].atv);
        if(d LT nearest_hs_d, 
            copy(nearest_hs_i, i);
            copy(nearest_hs_d, d);
        );
        background_hotspot(get(i), get(hotspot[get(i)].name));
    );

    if(nearest_hs_i GE 0 AND nearest_hs_d LT 10,
        highlight_hotspot(get(nearest_hs_i), get(hotspot[get(nearest_hs_i)].name)); 
    );
</action>


Best regards,
Klaus

  • »jeromebg« ist der Autor dieses Themas

Beiträge: 1 120

Wohnort: Angers - France

Beruf: 360 experiences creator

  • Nachricht senden

3

Sonntag, 23. August 2015, 15:41

Thanx Klaus, you're the master, works perfect !!!

  • »jeromebg« ist der Autor dieses Themas

Beiträge: 1 120

Wohnort: Angers - France

Beruf: 360 experiences creator

  • Nachricht senden

4

Montag, 18. Januar 2016, 19:18

Works perfect but it fires onover and onout too many times (each frame onviewchange in fact)
I made a example here : http://www.360images.fr/angers_360/index…ano=example.xml

I can't find a way to fire onout and onover only once...

If the hotspot is in the middle of the screen then callwith onover, if it goes out then callwith onout, this is not very difficult.

If the hotspot is in the middle of the screen then callwith onover, but if another one is more close to the center, then callwith onout for the first one...

A clue ?

  • »jeromebg« ist der Autor dieses Themas

Beiträge: 1 120

Wohnort: Angers - France

Beruf: 360 experiences creator

  • Nachricht senden

5

Montag, 18. Januar 2016, 21:37

I have changed the code to check if the new nearest distance is not the already nearest hotspot and I might be wrong, because if you rotate clockwise it works, and if you rotate the other way to onout is not called...

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
<action name="testhotspots">
set(nearest_hs_i,-1);
set(nearest_hs_d,10000);

    for(set(i,0), i LT hotspot.count, inc(i),
        getlooktodistance(d, hotspot[get(i)].ath, hotspot[get(i)].atv);

		if((d LT nearest_hs_d) AND (i != nearest_hs_i),
			background_hotspot(get(nearest_hs_i), get(hotspot[get(nearest_hs_i)].name));
			copy(nearest_hs_i,i);
			copy(nearest_hs_d,d);
			);		
      );
	  
	  if(nearest_hs_d LT 15,
        highlight_hotspot(get(nearest_hs_i), get(hotspot[get(nearest_hs_i)].name));
      );
	  
</action>

<action name="highlight_hotspot">
    if(hotspot[%1].ishighlighted != true,
        set(hotspot[%1].ishighlighted, true);
		callwith(layer[%2], onover);		
     );
</action>

<action name="background_hotspot">
	if(hotspot[%1].ishighlighted,
    	set(hotspot[%1].ishighlighted, false);
		callwith(layer[%2], onout);
	);
</action>

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

6

Dienstag, 19. Januar 2016, 00:05

..edit sorry i turned things around



*question*
Tuur *thumbsup*

  • »jeromebg« ist der Autor dieses Themas

Beiträge: 1 120

Wohnort: Angers - France

Beruf: 360 experiences creator

  • Nachricht senden

7

Dienstag, 19. Januar 2016, 11:48

Ok, working example ;)

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<action name="testhotspots">
set(nearest_hs_i,-1);
set(nearest_hs_d,10000);

    for(set(i,0), i LT hotspot.count, inc(i),
        getlooktodistance(d, hotspot[get(i)].ath, hotspot[get(i)].atv);

		if((d LT nearest_hs_d) AND (i != nearest_hs_i),
			background_hotspot(get(nearest_hs_i), get(hotspot[get(nearest_hs_i)].name));
			copy(nearest_hs_i,i);
			copy(nearest_hs_d,d);
			);
		if(d GT 15,
			background_hotspot(get(i), get(hotspot[get(i)].name));
			);		
      );
	  
	  if((nearest_hs_i GE 0) AND (nearest_hs_d LT 15),
        highlight_hotspot(get(nearest_hs_i), get(hotspot[get(nearest_hs_i)].name));
      );
	  
</action>

  • »jeromebg« ist der Autor dieses Themas

Beiträge: 1 120

Wohnort: Angers - France

Beruf: 360 experiences creator

  • Nachricht senden

8

Montag, 25. Januar 2016, 17:33

Oups, not working that much in fact...
If I have two hotspots near from each other then I can have two hotspot higlighted at the same time, but only when rotating counter clockwise ???
Very strange ?
http://www.360images.fr/angers_360/index…ano=example.xml

9

Samstag, 5. Oktober 2019, 18:38

Hi, did anyone come up with a solution for this? So that it doesn't fire all the time