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

Saturday, December 28th 2019, 9:37am

Zoom and VRController

Hi everyone,

I was trying to combine the VRController event and the zoom example (https://krpano.com/forum/wbb/index.php?p…&threadID=15582)

I was trying to zoom in WebVR mode when the user clicks on the VR controller (I am using oculus Go) and it will zoom in to see the exhibition.

Any help is deeply appreciated, please

Copied this on the zoom.xml


<style name="vrcontroller_laser"
url="res/laser.png"
crop="0|0|64|512"
onvrcontrollerbutton="
if(pressed,
set(movement_tolerance, 0.01);
set(zoom_speed, 1.0);

copy(last_tick, timertick);
copy(last_movement_tick, last_tick);
copy(last_view_hlookat, view.hlookat);
copy(last_view_vlookat, view.vlookat);

setinterval(webvr_zooming, 0.1,
copy(cur_tick, timertick);
if(webvr.isenabled,
getlooktodistance(move_distance, last_view_hlookat, last_view_vlookat);
calc(movespeed, move_distance / (cur_tick-last_tick));

calc(movement_tolerance, 0.01 / (webvr.zoom^0.5));
if(movespeed GT movement_tolerance,
copy(last_movement_tick, cur_tick);
tween(zoom_speed, 1.0, 0);
Math.pow(movespeed, 0.5);
);

if((cur_tick - last_movement_tick) GT 2000,
tween(zoom_speed, 1.04);
);

calc(new_zoom, webvr.zoom * (zoom_speed * (1.0 - movespeed)) );
clamp(new_zoom, 1, get(max_zoom));
tween(webvr.zoom, get(new_zoom), 0.1, linear);

calc(webvr.friction, new_zoom GT 2.0 ? (new_zoom - 2.0) / 100.0 : 0);
,
copy(last_movement_tick, cur_tick);
);
copy(last_tick, cur_tick);
copy(last_view_hlookat, view.hlookat);
copy(last_view_vlookat, view.vlookat);

);"
handrotate=""
onloaded.addevent="renderloop( calc(handrotate,'0|'+(random*360)+'|0|ZXY'); );"
/>