You are not logged in.

philkrom

Beginner

  • "philkrom" started this thread

Posts: 35

Location: Montpellier France

Occupation: Zooomez cofounder

  • Send private message

1

Friday, December 12th 2014, 11:49pm

Previous / next hotspots within riftplayer not working...

Hi

Because of Panotour, my knowledge of code is very poor... But I am convinced I have to dive into the code, and it is not easy ! *blink*

I want to modify the riftplayer (found on this link) to be able to make a "slideshow" of panoramas with Oculus, with 2 hotspots, next and previous.

So I have modified the code of tour.xml (found on this page ) as follows (lines 3 to 32) to add 2 actions and 2 hotspots :

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<krpano>

<action name="prevscene">
	if(%1 != findnext, sub(i,scene.count,1));
	txtadd(scenexml,'<krpano>',get(scene[%i].content),'</krpano>');
	if(scenexml == xml.content,
		dec(i);
		if(i LT 0, sub(i,scene.count,1));
		loadscene(get(scene[%i].name), null, MERGE, BLEND(1));
		,
		dec(i);
		if(i GE 0, prevscene(findnext));
	);
</action>

<action name="nextscene">
	if(%1 != findnext, set(i,0));
	txtadd(scenexml,'<krpano>',get(scene[%i].content),'</krpano>');
	if(scenexml == xml.content,
		inc(i);
		if(i == scene.count, set(i,0));
		loadscene(get(scene[%i].name), null, MERGE, BLEND(1));
		,
		inc(i);
		if(i LT scene.count,
		nextscene(findnext));
		);
</action>

	<hotspot name="spot1" style="suivant" ath="100" atv="+50"  keep="true" onclick="nextscene()"/>

	<hotspot name="spot2" style="precedent" ath="-100" atv="+50"  keep="true" onclick="prevscene()"/>

<scene name="nature3d-1">
	<image>
		<cube url="panos/nature3d-1/%$cubesideprefix%_pano_%s.jpg" />
	</image>
</scene>

  	<scene name="nature3d-2">
	<image>
		<cube url="panos/nature3d-2/%$cubesideprefix%_pano_%s.jpg" />
	</image>
</scene>

</krpano>


But when I try to go to the next (or previous) scene, I get the message 'scene "null" not found'. *confused*

And I have another issue : when I click (or hover) on a hotspot, it disapears once clicked. *cry*

I have found the code for the next and prev btns on this thread , by Klaus himself. And I don't understand where I am wrong.

The files index.html, rift.xml and tour.xml are attached in an archive.

Best regards !

Philippe
philkrom has attached the following file:
  • upforum.zip (32.17 kB - 50 times downloaded - latest: Today, 7:10pm)
Philippe - Newbie in krpano code but very interested in everything about Oculus and VR devices *w00t*

Cofounder of the Zooomez project - zmz.fr - map on this link
If you want to support our project, please like our Facebook page *thumbsup*

Umalo

Professional

Posts: 1,051

Location: Osijek, Croatia, EU

  • Send private message

2

Saturday, December 13th 2014, 1:55am

Try not with linked scene as you don't have them defined.

E.g. those are the actions and code you should replace with in your example

Source code

1
2
3
4
5
6
7
8
9
10
11
<action name="testhotspots">
		for(set(i,0), i LT hotspot.count, inc(i),
			getlooktodistance(d, hotspot[get(i)].ath, hotspot[get(i)].atv);
			if(d LT 7,
				<!--hotspot_in_focus(get(i), get(hotspot[get(i)].linkedscene));-->
				hotspot_in_focus(get(i));
			  ,
				hotspot_out_of_focus(get(i), 0.8, 0.8);
			  );
		  );
	</action>



Source code

1
2
3
4
5
6
	<action name="hotspot_in_focus">
	    if(hotspot[%1].infocus != true,
	        set(hotspot[%1].infocus, true);
	        tween(hotspot[%1].scale, 1.0, 2.0, default, if(side == left, prevscene();,nextscene();););
	      );
	</action>


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 <action name="prevscene">
    if(%1 != findnext, sub(i,scene.count,1));
    txtadd(scenexml,'<krpano>',get(scene[%i].content),'</krpano>');
    if(scenexml == xml.content,
       dec(i);
       if(i LT 0, sub(i,scene.count,1));
       <!--loadscene(get(scene[%i].name), null, MERGE, BLEND(1));-->
       js_sync_call(do_hotspot_onclick, dummy_name, get(scene[%i].name));
      ,
       dec(i);
       if(i GE 0, prevscene(findnext));
      );
</action>

<action name="nextscene">
    if(%1 != findnext, set(i,0));
    txtadd(scenexml,'<krpano>',get(scene[%i].content),'</krpano>');
    if(scenexml == xml.content,
       inc(i);
       if(i == scene.count, set(i,0));
       <!--loadscene(get(scene[%i].name), null, MERGE, BLEND(1));-->
       loadscene(get(scene[%i].name), null, MERGE, BLEND(1));
       
       js_sync_call(do_hotspot_onclick, dummy_name, get(scene[%i].name));
      ,
       inc(i);
       if(i LT scene.count, nextscene(findnext));
      );
</action>
 
		<hotspot name="spot1" ath="100" atv="+50"  	keep="true" url="suivant.png" 	scale="0.8" edge="top" onclick="nextscene()" />
		<hotspot name="spot2" ath="-100" atv="+50"  keep="true" url="precedent.png" scale="0.8" edge="top" onclick="prevscene()"/>
	
	<scene name="nature3d-1">
	<preview type="grid(cube,32,32,256,0xDD3322,0x555555,0xFF0000);" details="16" />
	</scene>

	<scene name="nature3d-2">
		<preview type="grid(cube,32,32,256,0xDD3322,0x111111,0xFFff00);" details="16" />
	</scene>

	<scene name="nature2d">
		<preview type="grid(cube,32,32,256,0xDD3322,0xcccccc,0xFFffff);" details="16" />
	</scene>

philkrom

Beginner

  • "philkrom" started this thread

Posts: 35

Location: Montpellier France

Occupation: Zooomez cofounder

  • Send private message

3

Saturday, December 13th 2014, 10:49am

Works !!!

Thanks a lot for your help, Umalo *thumbsup*


When I said I was a newbie... *cry*
Philippe - Newbie in krpano code but very interested in everything about Oculus and VR devices *w00t*

Cofounder of the Zooomez project - zmz.fr - map on this link
If you want to support our project, please like our Facebook page *thumbsup*