Disable Gyro while in webvr mode

  • Hello,

    What you need to do is edit the attributes onentervr and onexitvr inside the WebVR plugin which is located in the file 'webvr.xml'. But if I were you I wouldn't edit webvr.xml because you could over write it by mistake upgrading krpano.

    Look the following line in tour.xml

    <include url="%SWFPATH%/plugins/webvr.xml" />

    AFTER that line (very important) write the following code:

    <plugin name="WebVR" devices="html5" keep="true"
                onentervr="webvr_onentervr(); set(plugin[gyro].enabled,false);"
    	    onexitvr="webvr_onexitvr(); set(plugin[gyro].enabled,true);"

    WebVR plugin original code is:

    <plugin name="WebVR" devices="html5" keep="true"

    So basically you're overwriting both attributes by adding some custom code. It's a bit better in my opinion.

    I hope it helps,



  • Hi ParallaxVT,

    Appreciate it but it doesn't seem to work. I tried adding the plugin as you directed to tour.xml first. But gyro still got enabled when I entered VR.
    Also I added it to webvr.xml with the same result .

    I also switched gyro to false onexitvr and onentervr for both cases and tested it. It isn't working.

    Am I missing something. *sad*


    Dar maniac

  • Hello,

    This time I've tested it and it's actually very difficult to disable the gyro on VR Mode!
    My solution doesn't work because VR Mode doesn't use the gyro plugin *mellow*

    I've took a look to the WebVR documentation and it doesn't mention anything about how to disable the gyro. I think the use of it it's defined inside webvr.js itself and I can't find any option to turn it off.


  • Hi,

    the WebVR plugin and the gyro plugin are two independent plugins - the WebVR plugin has its own gyro tracking and when the plugin is enabled it takes automatically control about the pano view. That means when the gyro plugin was enabled before that doesn't matter for the WebVR plugin.

    WebVR itself without gyro tracking doesn't make sense - that's one of the core features of the plugin.

    The WebVR plugin itself is mainly a package of:

    • the 'real' WebVR browser API (for WebVR enabled browsers with VR headsets like the Oculus Rift or HTC Vice)
    • a solution for mobile devices with

      • manual gyroscope tracking
      • with lens pre-distortion
      • with a device screen-size detection for correct lens distortion and 'eye alignment'
      • a 'VR cursor'

    What usage case do you have?
    If you only want stereo rendering, this can be done also without any plugins - just enable the display.stereo setting...

    Best regards,

  • Hi Klaus,

    The usage case that I require is that in VR mode I want to have a fixed autorotation for every scene and after it reaches a specific view, it should automatically go to an adjoining scene.

    So for that I was trying to disable gyro. *g*


  • What usage case do you have?

    Hi! My customer wants panovideo with forced rotation based on some scenario.
    For example, when video starts in VR mode, it is necessary to disable gyro (like switching to simple stereo-rendering).
    Then we call lookto() and the camera turn on first man. After that we call lookto() and the camera turn on second man. Etc.

    Further we enable the gyroscope for full VR mode. There by we allowing user to turn his head after few seconds from start.

    I tried use display.stereo and then switch to VR but it is very bad solution because there is no smooth transition.


    What is right solution of my task?
    How to disable/enable gyro in VR?

  • What usage case do you have?

    As like others, I need to force the view change to what I'd like to see.
    For example, when users look at a hotspot the view looks where the hotspot located and zoom-in (fov change) using like " lookto( 10, 10, 40 ); "
    However, there's no use of lookto action in VR mode because Gyro is enabled.

    Since that,
    I'd like to temporary disable the gyro embeded in WebVR plugin.

    Any solution on this?

    Kabkee Moon.

  • Hi,

    I'd like to temporary disable the gyro embeded in WebVR plugin.

    Any solution on this?

    Yes - that's possible - see the 'headtracking' setting in the WebVR plugin documentation here:

    But I wouldn't recommend that - if you want to change the viewing direction in VR, better use the 'lookat' action of the WebVR plugin:

    Best regards,

Participate now!

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