Issue with VR Starter Kit Gyroscope

Hey Guys,

Just having an issue with my current project and managed to track it down to the easy VR Started Kit.

I see a lot of issues lately with the WebVR kit. This seems to be a chrome issue only.

Upon loading with mobile, the sensitivity is super high. The camera seems to be rotating to the right, even though the phone is not moving.

I’m going to try looking into the issue now. But was wondering if this has been noticed before and someone has beat me to it.

Build: https://playcanv.as/p/D99DmEOY/
Project: https://playcanvas.com/project/576211/overview

Thanks,
Dean

The polyfill on PlayCanvas side needs to be updated due to Chrome going from degrees to radians or visa versa?

See thread here: VR-mode apps super sensitive to motion

Okay, so I did some digging into the LookCamera script. I couldn’t find any other script that references movement of the camera without touch input or mouse input.

I noticed the script was using a converter from Rad to degrees. Hoping it would be an easy fix I removed the converter. But it was not the case. :frowning: Im guessing that the calculations of the the rads/degrees happens before the final conversion. Hence helping in no way shape or form.

LookCamera.prototype._getPitch = function(quat, yaw) {
    var quatWithoutYaw = LookCamera.quatWithoutYaw;
    var yawOffset = LookCamera.yawOffset;
    
    yawOffset.setFromEulerAngles(0, -yaw, 0);
    quatWithoutYaw.mul2(yawOffset, quat);
    
    var transformedForward = new pc.Vec3();
    
    quatWithoutYaw.transformVector(pc.Vec3.FORWARD, transformedForward);
    // "* pc.math.RAD_TO_DEG" is gone from below
    return Math.atan2(transformedForward.y, -transformedForward.z);
};


LookCamera.transformedForward = new pc.Vec3();

LookCamera.prototype._getYaw = function (quat) {
    var transformedForward = LookCamera.transformedForward;
    quat.transformVector(pc.Vec3.FORWARD, transformedForward);
    // "* pc.math.RAD_TO_DEG" is gone from below
    return Math.atan2(-transformedForward.x, -transformedForward.z) /* * pc.math.RAD_TO_DEG */;    
};

You said you tried a quick fix. What, where or how did you tinker?

I also enabled WebVR on my phone for chrome. Nothing changed. Except I cannot use the click and tap movement functions either now.

**edit: Just went through the thread again. Remembered to bring up the polyfill.

So is this polyfill a library that playcanvas loads before start up, to which the suggested fix would be to pull the latest repo and then somehow get playcanvas to accept it before/after load? Or change it manually in the build source.

I can’t actually remember :thinking: I think I changed a couple of lines in the polyfill to use radians but as it’s only Chrome that has this problem, I wasn’t confident that this would be the fix since it is different if you used Firefox.

I hadn’t tried just swapping the polyfill to the latest version after I download a self hosted build.

I’ll give the “update polyfill after a self hosted build” idea later on and will update the thread.

Any update guys? Could do with confirmation of a fix even if it’s chrome only before starting our next project.

Actually seems like the issue is chrome for android only, firefox for Android seems even worse.

Does converting from rads to degrees work or is there something else at play?

Thanks

+1 for an update. This problem has been reported a few times now, and there has been no feedback about a fix ( which could be as simple as updating the polyfill version internally )

Hey Guys,

Just to reply. Haven’t been able to check this out.

I will try to get back round to this. But its not going to be for a couple of weeks at least.

Thanks,
Dean

Hi epikos1994, I was referring to the PlayCanvas developers, to see if they could give some feedback here on the problem and any possible solution.