You are not logged in.

1

Sunday, July 12th 2015, 2:18pm

Switch between scenes based on scene name

Hi,

Just started using Krpano and i'm trying to figure out what's the best approach to achieve the following :

I have a tour with 3 different rooms. Each room can be displayed in 9 different variations based on time and floor type.


TIME
-morning
-noon
-evening

FLOOR
-oak
-ash
-maple


SCENE NAME EXAMPLE

scene_kitchen_morning_oak
scene_kitchen_morning_ash
.................................
.................................
scene_kitchen_noon_ash
scene_kitchen_noon_maple
................................
.
.................................
.................................
scene_kitchen_evening_ash
s
cene_kitchen_evening_maple

scene_living_morning_oak

scene_living_morning_ash
..................................
..................................
.................................
scene_living_evening_ash
scene_living_evening_maple



I plan to use 2 buttons , each with its own options for TIME and FLOOR TYPE visible on all scenes. How would the code look like when I move from one room to another using hotspots or radar hotspots keeping the current scene selection?

EXAMPLE :

If the current scene is [scene_kitchen_noon_ash] when i move to the living room i wanna go to [scene_living_noon_ash].


Thanks in advance,
Alex

Umalo

Professional

Posts: 1,051

Location: Osijek, Croatia, EU

  • Send private message

2

Sunday, July 12th 2015, 11:48pm

Instead of using regular loadscene you can use your own loadscene action. E.g.:

Source code

1
2
3
4
5
6
7
<action name="your_load_scene_action">
<!--set(tour_time,morning);
set(tour_floor,oak);		-->
txtadd(scene2load,%1,'_',get(tour_time),'_',get(tour_floor));
<!--trace(get(scene2load));		-->
loadscene(get(scene2load),MERGE,BLEND(0.5));
</action>

In this case take care to set variables tour_time and tour_floor correctly.
If you are using system where each hotspots is having linkedscene attribute use it same way but calling your action. Hotspot style example:

Source code

1
onclick="if(linkedscene, skin_hidetooltips(); tween(scale,0.25,0.5); tween(oy,-20,0.5); tween(alpha,0,0.5); looktohotspot(); your_load_scene_action(get(linkedscene)); skin_updatescroll(); );"

regards
Umalo

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

3

Monday, July 13th 2015, 4:00pm

Hi!


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<krpano daytime="morning">

<action name="customloadscene">
  loadscene(scene_%1_%2_%3);
</action>

...

<hotspot
     ...
    linkedscene="kitchen"
    floor="oak"
    onclick="customloadscene(get(linkedscene),get(floor),get(daytime)); 
    ...
/>

...

</krpano>


You can define anywhere daytime like set(daytime,noon); in some switcher for example
or even in url : www.mysite.com/tour.html?daytime=noon

Regards

Andrey
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

4

Monday, July 13th 2015, 10:22pm

Thanks

Hi Umalo,

Thank for your help. You provided a great start for my project which otherwise I would have spent many weeks trying to figure out on my own.

Regards,

Ciprian

5

Monday, July 13th 2015, 10:32pm

Andrey,

Thanks for your example. I've just learned how to use arguments when calling a function using %1 %2 etc.


Regards,
Ciprian

Similar threads