Skip to content
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
Closed

DeviceOrientationCamera does not work #78

amerkoleci opened this issue Oct 9, 2013 · 4 comments
Labels

Comments

@amerkoleci
Copy link

@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);
};
@amerkoleci
Copy link
Author

@amerkoleci 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
Copy link
Author

@amerkoleci amerkoleci commented Oct 9, 2013

Into your sample your not using DeviceOrientationCamera.

@deltakosh
Copy link
Contributor

@deltakosh 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants