New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeviceOrientationCamera does not work #78

Closed
amerkoleci opened this Issue Oct 9, 2013 · 4 comments

Comments

Projects
None yet
2 participants
@amerkoleci

amerkoleci commented Oct 9, 2013

Basically DeviceOrientationCamera derives from FreeCamera, this makes movement with arrow and mouse not working, but the problem is that even with the orientation of device it does not work, you can try it into your browser using chrome mobile simulation you'll see that it won't work.

Basically offsetX and offsetY are always 0.

BABYLON.DeviceOrientationCamera.prototype.attachControl = function (canvas, noPreventDefault) {
if (this._attachedCanvas) {
return;
}
this._attachedCanvas = canvas;

    if (!this._orientationChanged) {
        this._orientationChanged = function (evt) {

            if (!this._initialOrientationGamma) {
                this._initialOrientationGamma = evt.gamma;
                this._initialOrientationBeta = evt.beta;
                   // Probably return here?
            }

            this._orientationGamma = evt.gamma;
            this._orientationBeta = evt.beta;

           //  OffsetX and offset Y is always 0.
            this._offsetY = (this._initialOrientationBeta - this._orientationBeta) * 0.05;
            this._offsetX = (this._initialOrientationGamma - this._orientationGamma) * -0.05;
        };
    }

    window.addEventListener("deviceorientation", this._orientationChanged);
};
@deltakosh

This comment has been minimized.

Show comment
Hide comment
@amerkoleci

This comment has been minimized.

Show comment
Hide comment
@amerkoleci

amerkoleci Oct 9, 2013

Nope, try to use only the DeviceOrientationCamera into your sample and you'll see that into checkInputs method _offsetX is always null.

amerkoleci commented Oct 9, 2013

Nope, try to use only the DeviceOrientationCamera into your sample and you'll see that into checkInputs method _offsetX is always null.

@amerkoleci

This comment has been minimized.

Show comment
Hide comment
@amerkoleci

amerkoleci Oct 9, 2013

Into your sample your not using DeviceOrientationCamera.

amerkoleci commented Oct 9, 2013

Into your sample your not using DeviceOrientationCamera.

@deltakosh

This comment has been minimized.

Show comment
Hide comment
@deltakosh

deltakosh Oct 9, 2013

Contributor

you can go on the main site, select Espilit scene (for instance), and into the control panel, you can change the camera to a DeviceOrientationCamera

I've just tested it on my surface and it works

Contributor

deltakosh commented Oct 9, 2013

you can go on the main site, select Espilit scene (for instance), and into the control panel, you can change the camera to a DeviceOrientationCamera

I've just tested it on my surface and it works

@deltakosh deltakosh closed this Oct 11, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment