You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Monday, January 4th 2016, 1:13pm

How to restrict some hotspots appearing when in VR mode

I have a tour with hotspot 'arrows' to guide the viewer around.

At the start and end of the tour, 'onclick' loads a new html file. Works fine in non VR mode, my issue is that in VR mode loading a new html file will exit VR (which is fine and to be expected) but is confusing if you are still 'inside' the VR experience, i.e. google cardboard.

So... I'd like to add some code to certain arrows to stop them appearing when in VR mode. Here is my code for the 'arrow' :

<hotspot name="arrow-0"
url="../hotspots/yellow-arrow.png"
alpha="0.8"
scale="0.5"
distorted="true"
rx="-60.0"
ath="0"
atv="6"
zoom="true"
onhover="showtext(' ',hotspottextstyle);"
onclick="openurl(next-tour.htm?scenetoload=pano413,_self)"
/>


Any help, much appreciated.

Thanks

Tim

Posts: 1,856

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

2

Monday, January 4th 2016, 5:30pm

One way.

plugins/webvr.xml

<plugin name="WebVR" .. onentervr="set(hotspot[arrow-0].visible,false);" onexitvr="set(hotspot[arrow-0].visible,true);"
<scene onstart="if(webvr.vr_cursor_enabled,set(hotspot[arrow-0].visible,false););"
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

3

Monday, January 4th 2016, 8:19pm

Thanks for this, will try it out.

I may set it as a group that way I can just put arrows I don't want to appear in VR in a separate group.

Will post the final code.

Cheers
Tim

Posts: 1,856

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

4

Tuesday, January 5th 2016, 6:44pm

Yes, there are much better ways using actual code based on attributes etc using a loop to check all hotspots and attributes.
There's decentish posted code here for this back posted somewhere.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

Red

Trainee

Posts: 99

Location: Australia

Occupation: Virtual tour creator, VR app developer

  • Send private message

5

Wednesday, January 6th 2016, 6:33am

You could add a couple of actions like the one explained by Klaus here

Toggle, hide-unhide HotSpots HTML5/ JS Viewer iPhone/iPad


You'd need two actions, one assigned to onentervr and one assigned to onexitvr

For example:

- In the code of hotspots to be hidden, add an attribute novrspot="yes"
- add two actions


Source code

1
<action name="hidespot">  for(set(i,0), i LT hotspot.count, inc(i),     if(hotspot[get(i)].novrspot == yes,         set(hotspot[get(i)].visible,false);       );    );</action>



Source code

1
<action name="showspot">  for(set(i,0), i LT hotspot.count, inc(i),     if(hotspot[get(i)].novrspot == yes,         set(hotspot[get(i)].visible,true);       );    );</action>



- Call the actions at onentervr and onexitvr
eg. <plugin name="WebVR" ... onentervr="... hidespot();" onexitvr="... showspot();"


- Can also add this to the hotspots code

Source code

1
onloaded="if(webvr.isenabled == true, set(visible, false);); if(webvr.isenabled == false, set(visible, true););" 


This will ensure the hidden hotspots don't reappear after switching/reloading scenes while still in VR Mode.

6

Saturday, January 9th 2016, 6:33pm

Hi Guys

Thanks for the advice.

I created a group which contains the 'enter VR ' layer. and then I turn the group 'on/off' in each pano via:

set (plugin[group5].visible,false);

or set (plugin[group5].visible,true);

Then added:

onloaded="if(webvr.isenabled == true, set(visible, false);); if(webvr.isenabled == false, set(visible, true););"

To the arrows at the start and end of each tour (which normally call another html tour).

So this way visitor can only enter VR when then are within the body of the tour and arrows to other external tours no longer appear at 'each end' of the current tour.

Thanks again for suggestions.

Tim