Sie sind nicht angemeldet.

1

Dienstag, 26. Februar 2019, 09:33

removing hotspots dynamicaly

Hi krpano experts ..

i make kind of a krpano game with multichoice options.
in this game i get a bunch of hotspots made thrue user interaction in runtime which names i collect in array "arr"

i need to remove this hotspots and replace them thrue new ones in a new game situation.

when i try to remove it "dynamicaly" it this way:

Quellcode

1
2
3
4
5
6
    for(set(i,0), i LT arr.count, inc(i),

      trace('arr[',get(i),'].value=',arr[get(i)].value);

      removehotspot(arr[get(i)].value);
      );


it doesn't work .. WHY???
<!--
Trace Result:
arr[0].value=item_0
arr[1].value=item_1
arr[2].value=item_2
arr[3].value=item_3
arr[4].value=item_4
-->


removing "manualy" after same user interaction with:

Quellcode

1
2
3
4
5
 	removehotspot(item_0);
 	removehotspot(item_1);
 	removehotspot(item_2);
 	removehotspot(item_3);
 	removehotspot(item_4);


works

2

Dienstag, 26. Februar 2019, 09:48

trace() does this automatically, but otherwise you need to get the value:

removehotspot(get(arr[get(i)].value));

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

3

Dienstag, 26. Februar 2019, 12:19

Hi,

for removing hotspots in for loop you need to do something like

Quellcode

1
2
3
4
5
for(sub(i,hotspot.count,1), i GE 0, dec(i),
 
     removehotspot(get(hotspot[get(i)].name));
   
);


or :

Quellcode

1
2
3
4
5
6
for(set(i,0), i LT hotspot.count, inc(i),
 
     removehotspot(get(hotspot[get(i)].name));
     dec(i);
   
);





instead of your 'normal' for loop.
This is because the hotspot index changes when you remove hotspots.
Not sure about your particular case though..

Hope it helps!
Tuur *thumbsup*

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Tuur« (26. Februar 2019, 13:29)


4

Dienstag, 26. Februar 2019, 16:58

Hi Tuur ..

i didn't want to remove all hotspots but only the few my user generatet in the particular game interaction which names are collect in array "arr" ..

btw...
removehotspot(get(arr[get(i)].value));
ist the sollution ..

the problem i had was that it doesn't worked in VRmode unless i have dalayed the call .. bit strange ..

someone else had an issue wchich could be solved with delayedcall?

greetz
mil