You are not logged in.

1

Tuesday, February 26th 2019, 9:33am

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:

Source code

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:

Source code

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


works

2

Tuesday, February 26th 2019, 9:48am

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

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

Tuur

Sage

Posts: 3,113

Location: Netherlands

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

  • Send private message

3

Tuesday, February 26th 2019, 12:19pm

Hi,

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

Source code

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


or :

Source code

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*
http://www.virtualtuur.com
Skype:studiotuur

This post has been edited 1 times, last edit by "Tuur" (Feb 26th 2019, 1:29pm)


4

Tuesday, February 26th 2019, 4:58pm

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