"stare" function for non-Cardboard tours

Q&A about the latest versions
User avatar
stalwart
Posts: 651
Joined: Thu Oct 02, 2008 11:52 am

hi all,

can we use the "stare" function for non-Cardboard tours? So, if holding an iPad, you don't need to physically click a HS to change scene, just hover the marker over the HS and let the "stare" function change scene?

Stu
User avatar
thomas
Chief Gnome
Posts: 2611
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

Hello Stu,

the code for this functionality is cardboard HTML template. If you add the following code just before the closing </script> tag in your HTML page you can get the same functionality on a normal panorama.

Code: Select all

// code for the stare navigation
		var lastNode;
		var hotspotArray=[];
		var cHotspot;
		var hotspotEnterTime;
		function stareNavigation() {
			if ((pano) && (pano.isLoaded)) {
				if (pano.getCurrentNode()!=lastNode) {
					lastNode=pano.getCurrentNode();
					hotspotArray=[];
					var ids=pano.getPointHotspotIds();
					for(var i=0;i<ids.length;i++) {
						var id=ids[i];
						var hotspot=pano.getHotspot(id);
						hotspotArray.push(hotspot);
					} 
				}
				var cPan=pano.getPan();
				var cTilt=pano.getTilt();
				var found=false;
				for (var i = 0; i < hotspotArray.length; i++) {
					var hotspot = hotspotArray[i];
					var dist=5;
					var pdif=(hotspot.pan-cPan);
					while(pdif<-180) pdif+=360.0;
					while(pdif>180) pdif-=360.0;
					if ((Math.abs(pdif)<(dist*Math.cos(cTilt * Math.PI/180.0))) && 
						(Math.abs(hotspot.tilt-cTilt)<dist)) {
						if (hotspot!=cHotspot) {
							cHotspot=hotspot;
							hotspotEnterTime=Date.now();
						}
						found=true;
						break;
					}
				}
				if (found) {
					if ((hotspotEnterTime+2000)<Date.now()) {
						cHotspot.div.onclick();
						cHotspot=null;
					}
				} else {
					cHotspot=null;
				}
			}
		}
		setInterval (stareNavigation, 100);
MfG, Thomas
User avatar
stalwart
Posts: 651
Joined: Thu Oct 02, 2008 11:52 am

Hi Thomas,

Cool - thanks.

Following on, will this work / can I use the "stare" function over a hotspot to call up a text box, for example, "staring" over one of the info boxes in the gym scenes on this tour?:

http://www.360imagery.co.uk/virtualtour ... grove_park

Stu
ALahode
Posts: 26
Joined: Thu May 12, 2016 4:45 pm
Location: Bielefeld, Germany

Hi.

I use the code on a normal panorama output. It works, but I have a problem.
When I go to another panorama with gyroscope control and stare navigation, the position of the target is not correct.

I made a test with 2 hotspots to the same tour node.
One hotspot with target position 0/0/120, the second hotspot with target position -177/-0/120.
http://home.arcor.de/andre.lahode/output

When I tap the hotspot on iPad it works correct. But when I use the hotspot via stare navigation, the target positions are the same.
When I swipe the pano and use the stare navigation, it’s also correct.

What can I do? Any idea?

Thanks.
André
User avatar
Hopki
Gnome
Posts: 13004
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

HI André,
I have tested your link with an iPhone 6S an iPad mini and an iPad Air.
I tested in landscape and portrait on all devices.
The link opens with the red dot and hotspot top left and bottom right.
I can turn to either hotspot and lining up the centre mark, the hotspot changes nodes to the cyan dot with a hotspot in the bottom right.
Moving to aline the hotspot to the centre mark changes nodes back to the first.
I tested the above with all three devices and all is working as expected.

What do you see?
What is your testing device?
Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
ALahode
Posts: 26
Joined: Thu May 12, 2016 4:45 pm
Location: Bielefeld, Germany

Hi Martin.

Thanks for the answer.

When I change the node in the bottom right, I see the cyan dot with the same position like the other hotspot (0/0/120).
But it should be -177/-0/120.
When I tap on iPad (or click with a desktop browser) the hotspot bottom right, it works correct. I only have problems with stare navigation.

My device: iPad4 with iOS9.

Regards.
André
User avatar
Hopki
Gnome
Posts: 13004
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi André,
OK I see what your saying now.
Can you send me the complete project images as well so I can build here and have a look.
Regards,
Hopki
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
ALahode
Posts: 26
Joined: Thu May 12, 2016 4:45 pm
Location: Bielefeld, Germany

Hi Hopki.

Here it is.

Regards.
André
Attachments
stare_problem.zip
(1.08 MiB) Downloaded 227 times
ALahode
Posts: 26
Joined: Thu May 12, 2016 4:45 pm
Location: Bielefeld, Germany

Hi Hopki.

Could you take a look at my files?

Regards.
André
User avatar
Hopki
Gnome
Posts: 13004
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

HI André,
I have been looking at this and will have to add it to the bug tracker as it looks as if the stare function is opening each node looking the same direction and not obeying the target.
Regards,
Hopki
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
ALahode
Posts: 26
Joined: Thu May 12, 2016 4:45 pm
Location: Bielefeld, Germany

Hi Hopki.

Ok and thanks for your help.

Regards.
André
ALahode
Posts: 26
Joined: Thu May 12, 2016 4:45 pm
Location: Bielefeld, Germany

Hi Hopki.

Today I tested the stare function with Pano2VR 5.2 beta 3.
Unfortunately the problem with the incorrect target position still exists.

Are there plans to fix the problem?

Regards.
André
User avatar
Hopki
Gnome
Posts: 13004
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi André,
You need to deselect True North in the cardboard template.
The it will use the target view.
Regards,
Hopki
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
ALahode
Posts: 26
Joined: Thu May 12, 2016 4:45 pm
Location: Bielefeld, Germany

Hi Hopki.

I deselected True North every time.
I think the problem is the "code for stare navigation" above.

When I look in the new code from Pano2VR 5.2 beta 3 there is something different.

Code: Select all

gyro.reset();
setTimeout(function(){ gyro.reset(); },1);
So this works for me:

Code: Select all

			// code for the stare navigation
      var lastNode;
      var hotspotArray=[];
      var cHotspot;
      var hotspotEnterTime;
      function stareNavigation() {
         if ((pano) && (pano.isLoaded)) {
            if (pano.getCurrentNode()!=lastNode) {
               lastNode=pano.getCurrentNode();
               hotspotArray=[];
               var ids=pano.getPointHotspotIds();
               for(var i=0;i<ids.length;i++) {
                  var id=ids[i];
                  var hotspot=pano.getHotspot(id);
                  hotspotArray.push(hotspot);
               }
            }
            var cPan=pano.getPan();
            var cTilt=pano.getTilt();
            var found=false;
            for (var i = 0; i < hotspotArray.length; i++) {
               var hotspot = hotspotArray[i];
               var dist=5;
               var pdif=(hotspot.pan-cPan);
               while(pdif<-180) pdif+=360.0;
               while(pdif>180) pdif-=360.0;
               if ((Math.abs(pdif)<(dist*Math.cos(cTilt * Math.PI/180.0))) &&
                  (Math.abs(hotspot.tilt-cTilt)<dist)) {
                  if (hotspot!=cHotspot) {
                     cHotspot=hotspot;
                     hotspotEnterTime=Date.now();
                  }
                  found=true;
                  break;
               }
            }
            if (found) {
               if ((hotspotEnterTime+2000)<Date.now()) {
                  cHotspot.div.onclick();
                  				gyro.reset();
						setTimeout(function(){ gyro.reset(); },1);
                  cHotspot=null;
               }
            } else {
               cHotspot=null;
            }
         }
      }
      setInterval (stareNavigation, 100);
Thanks and best regards.
André
TDanton
Posts: 4
Joined: Wed May 03, 2017 12:03 pm

How could the 'stare' function be used for button clicking as well?
Post Reply