You are not logged in.

1

Monday, November 16th 2020, 7:51pm

Krpano WebVR cursor position

Hi,

Is there an variable that returns the VR target cursor position, or does it have to be calculated from the controller position and the direction vector?

This post has been edited 2 times, last edit by "FeelThePoveR" (Nov 17th 2020, 10:32pm)


2

Sunday, November 22nd 2020, 10:12am

Hi,

it can/need to be calculated.

The depth/distance of the target position need to be given from somewhere, e.g. when hitting a hotspot there is the hitd variable which defines the distance to the hitpoint on the hotspot plane.

See the in webvr.xml the 'vrcontroller_target_point' action as example.

Best regards,
Klaus

3

Monday, November 23rd 2020, 9:43pm

Thanks for the answer!

I've looked at the webvr.xml the 'vrcontroller_target_point', but the calculations used there don't seem to return the correct values in my js plugin.
Am I using the right krpano hotspot variables?
Also the distance (hitd) is always 0 for some reason.

I'm using Oculus GO headset with Firefox reality browser installed for remote debugging. I'm testing this on 'webvr-controllers' pano.

And here's the relevant piece of code:

Source code

1
2
3
4
5
6
7
8
9
var controllers = krpano.get("webvr.vrcontrollers");
var mainController = controllers[0];
var distance;
if(mainController.hs.hitd > 0)
    distance = mainController.hs.hitd;
else
    distance = 1000;
var clickX = mainController.hs.tx + mainController.hs.dx * distance;
var clickY = mainController.hs.ty + mainController.hs.dy * distance;