I finally managed to have DeviceOrientation work for projects generated by Marzipano tool.
Here are the steps I took:
1. in the vendor folder add DeviceOrientationControlMethod.js
2. in index.html:
after the line:
<script src="vendor/marzipano.js" ></script>
add:
<script src="vendor/DeviceOrientationControlMethod.js"></script>
3. in index.js:
under:
var controls = viewer.controls();
add
var deviceOrientationControlMethod = new DeviceOrientationControlMethod();
controls.registerMethod('deviceOrientation', deviceOrientationControlMethod);
under the toggleAutorotate() function add the following function:
function enableGiro(scene) {
deviceOrientationControlMethod.getPitch(function(err, pitch) {
if (!err) {
scene.view.setPitch(pitch);
}
});
controls.enableMethod('deviceOrientation');
giroenabled = true;
toggleElementGiro.className = 'enabled';
}
I hope this will help.
Thomas