我已将 DeviceOrientationControls 修改为朝北,而不是设备启动时的方向,虽然它可以在 Android 上运行,但我在 iOS 版本上运行时遇到了困难。这是我的修改版本
/**
* @author richt / http://richt.me
* @author WestLangley / http://github.com/WestLangley
*
* W3C Device Orientation control (http://w3c.github.io/deviceorientation/spec-source-orientation.html)
*/
THREE.DeviceOrientationControls = function ( object ) {
var scope = this;
this.object = object;
this.object.rotation.reorder( 'YXZ' );
this.enabled = true;
this.deviceOrientation = {};
this.screenOrientation = 0;
this.alphaOffset = 0; // radians
this.absolute = false;
this.alphaOffsetDevice = undefined;
this.alphaOffsetScreen = undefined;
var onDeviceOrientationChangeEvent = function ( event ) {
if(scope.absolute) return;
scope.deviceOrientation = event;
}; …Run Code Online (Sandbox Code Playgroud)