提交 9fd09725 编写于 作者: M Mr.doob

Merge pull request #5506 from s9k/orbit-controls-angle-outside

OrbitControls: Added access to angle values from the outside
......@@ -100,6 +100,8 @@ THREE.OrbitControls = function ( object, domElement ) {
var dollyEnd = new THREE.Vector2();
var dollyDelta = new THREE.Vector2();
var theta;
var phi;
var phiDelta = 0;
var thetaDelta = 0;
var scale = 1;
......@@ -248,11 +250,11 @@ THREE.OrbitControls = function ( object, domElement ) {
// angle from z-axis around y-axis
var theta = Math.atan2( offset.x, offset.z );
theta = Math.atan2( offset.x, offset.z );
// angle from y-axis
var phi = Math.atan2( Math.sqrt( offset.x * offset.x + offset.z * offset.z ), offset.y );
phi = Math.atan2( Math.sqrt( offset.x * offset.x + offset.z * offset.z ), offset.y );
if ( this.autoRotate ) {
......@@ -324,6 +326,18 @@ THREE.OrbitControls = function ( object, domElement ) {
};
this.getPolarAngle = function () {
return phi;
};
this.getAzimuthalAngle = function () {
return theta
};
function getAutoRotationAngle() {
return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册