WebVR and hotspot.onclick

  • Hi,

    I am having problems with my hotspot.onclick code in the WebVR mode.

    To set the starting view on the target scene after a transition I define custom properties in <hotspot>: hlookat, vlookat
    This is my hotspot.onclick code (defined in skin_hotspotstyle):

    Code
    if(linkedscene, skin_hidetooltips(); tween(scale,0.25,0.5); tween(oy,-20,0.5); tween(alpha,0,0.5); looktohotspot();
    loadscene(get(linkedscene),null,get(skin_settings.loadscene_flags),get(skin_settings.loadscene_blend));
    lookat(get(hlookat), get(vlookat), 70.0); skin_updatescroll(); );


    Normally after a transition the new scene is displayed with (hlookat, vlookat).
    With WebVR on mobile instead just the global starting view of the scene is being loaded instead, like if I click on a tile.
    In another words, this code:

    Code
    lookat(get(hlookat), get(vlookat), 70.0);

    is being just ignored.
    WebVR in "desktop fake" mode works also well though.

    Is there an easy way to fix/work this around?
    Thanks.

  • Hi,

    look at the <skin_settings> element in the tour.xml and there change the "webvr_gyro_keeplookingdirection" setting to "true" to avoid that the looking direction will be set back to the initial scene view settings when loading a new scene.

    Best regards,
    Klaus

  • Hi Klaus and JPhD,


    Thank you for your responses.


    So webvr_gyro_keeplookingdirection is not an option for me, as I am using an old skin (from 1.18) which doesn't contain any WebVR-related code.


    This actually does the trick - this way I can update hlookat:

    Code
    plugin[webvr].resetsensor(get(my_hlookat));

    But only if I call this code manually when the target scene is already loaded.
    If I attach it to the event:

    Code
    <events name="webvr_events" keep="true" devices="html5" onxmlcomplete="plugin[webvr].resetsensor(get(my_hlookat));"/>

    it doesn't work, even though this code gets called.
    Would you recommend subscribing this code to some other event?

  • Hi,

    based on exchange with Klaus (and vtourskin.xml *wink* )

    In my own XML,
    before to leave the scene,
    - I initiate next hlookat, vlookat variables
    - I load the target scene
    after loading,
    - if Gyroscope is active,
    -- I resetsensor at hlookat variable and I force lookat location.

    This is running in my caving tour showcase.
    but I need to modify the management of next/prev scene hotspot proposed in the skin settings control bar, to be more complete. *squint*

  • After a few approaches it worked,

    in hotspot.onclick I replaced this

    Code
    lookat(get(hlookat), get(vlookat), 70.0);

    with this

    [font='&quot']

    Code
    if(webvr.isenabled, plugin[webvr].resetsensor(get(vr_hlookat)), lookat(get(hlookat), get(vlookat), 70.0));

    [/font]

    vr_hlookat is initialized before leaving the previous scene, as you suggested.

    Thanks a lot!

Participate now!

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