sliding door hotspot

  • dear forum members


    in a recent panorama tour i use image hotspots as sliding doors.

    with a simple onclick="tween(ox,-750,4,easeinoutquint)" this works very well.


    my wish would now be to start the open-action when the sliding door comes into view.

    something like actionstart on look to sliding door-hotspot


    thanks for help


    klaus

  • dear forumpeople


    Isn't there a simple example for my problem.
    the postings to getlooktodistance are too complicated for me.

    I use a hotspot as a sliding door and it should open when the camera looks at it.
    What is the standard procedure; what information do I have to read out and how is it passed on.


    wbr klaus

    example: in the 2nd and the 3d scene my sliding doors are used. currently the doors can be opened with onclick....

    https://360.tirol/leo23/

  • Here is a simple example :

    http://krpano.kri-soft.be/examples/getlooktodistance/

    basically

    • setup scene with 2 hotspots
    • one hotspot has "click" action associated, the other no action
    • we setup an onviewchanged() event that will check if we look at the second hotspot
    • when event is triggered, we use getlooktodistance with the targethotspot. if the view angle < 20, we change the color. If view angle > 20, we revert the color back
  • Hello KME, I adapted your code to help me show a photo that I have as a hotspot with alpha="0", when going through the assigned angle range. She worked perfectly in a scene where that event occurs only once. In the following scene I have 2 photographs to show at different points,
    but it only shows me a photograph, I reverse the order of the codes and it always shows me the one in the last place.

    <events name="check_viewathotspot_oapv_foto" keep="true" onviewchanged="togglehotspot"/>
    <action name="togglehotspot" scope="local">

    getlooktodistance(current_angle, hotspot[oapv_foto].ath,
    hotspot[oapv_photo].atv);
    set(hs, get(hotspot[oapv_foto]));

    if (current_angle LT 30,
    <!-- dosomething when hotspot is in viewing range -->
    set(hs.alpha, "1");
    ,
    set(hs.alpha, "0");
    );

    trace(get(current_angle));
    </action>

    <events name="check_viewathotspot_ao_f" keep="true" onviewchanged="togglehotspot"/>
    <action name="togglehotspot" scope="local">

    getlooktodistance(current_angle, hotspot[ao_f].ath, hotspot[ao_f].atv);
    set(hs, get(hotspot[ao_f]));

    if (current_angle LT 30,
    <!-- dosomething when hotspot is in viewing range -->
    set(hs.alpha, "1");
    ,
    set(hs.alpha, "0");
    );

    trace(get(current_angle));
    </action>


    I placed this action outside the scenes:
    <action name="swapalpha" args="name">
    trace(get(name));
    set(hs, get(hotspot[get(name)]));
    if (hs.alpha == "0", set(hs.alpha, "1"), set(hs.alpha,"0"));
    </action>

    What am I doing wrong?

  • First, you have a typo:

    Code
    getlooktodistance(current_angle, hotspot[oapv_foto].ath, hotspot[oapv_photo].atv);

    foto / photo *wink*

    But I think your problem is because krpano only allows for one onviewchanged() event to be defined, so my suggestion would be to put both the checks inside the same action and only define one event.

    So something like this (untested):

  • Hello, can you just add doors to the hotspot

    Code
    onloaded="drag()" ox="0"	 
    drag="adjusthlookat(10);
       if( (ath LT calc(view.hlookat + 30)) AND (ath GT calc(view.hlookat - 30)), 
         if(ox == 0, tween(ox, -750)); 	
         ,	
         if(ox == -750, tween(ox, 0));	
       );	 
      delayedcall(0.01, if(drag, drag()) );					
    "

    or so

    Code
    onloaded="drag()" ox="0" 
    drag="getlooktodistance(cur_angle, ath, atv); 
     if( cur_angle LE 30,  
      tween(ox, -200); 	
      ,	
      tween(ox, 0);	
     );	 
    delayedcall(0.01, if(drag, drag()) );					
    "
  • a new problem

    with this code i can get all hotspots with x at the beginning of the title



    but when i try a tween instead of set, nothing happens any more




    there is a problem with this code. it doesn't work

    wbr klaus

    Edited 2 times, last by nikonutsch (January 10, 2023 at 11:49 AM).

  • with this code i can get all hotspots with x at the beginning of the title


    hi... just fyi..
    best use the source code button (#) if you post code.
    otherwise yr code is difficult to read and people wont help.

    about the tween... this probably works
    tween(hotspot[get(hs.name)].ox, -200,3);

  • thanks everyone for the great help

    Finally, I added a variable so and sc to the door hotspots in order to use different opening states of the sliding doors


    Edited 3 times, last by nikonutsch (January 10, 2023 at 1:07 PM).

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!