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:

    Code
    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:

    Code
    removehotspot(item_0);
     	removehotspot(item_1);
     	removehotspot(item_2);
     	removehotspot(item_3);
     	removehotspot(item_4);

    works

  • Hi,

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

    Code
    for(sub(i,hotspot.count,1), i GE 0, dec(i),
     
         removehotspot(get(hotspot[get(i)].name));
       
    );

    or :

    Code
    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*

  • 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

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!