Browse Source

Fixing issue with ArcRotateCamera when beta = 0

David Catuhe 9 năm trước cách đây
mục cha
commit
d0e62ba510

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/babylon.core.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 589 - 589
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/babylon.js


+ 3 - 0
dist/preview release/babylon.max.js

@@ -12053,6 +12053,9 @@ var BABYLON;
             var sina = Math.sin(this.alpha);
             var sina = Math.sin(this.alpha);
             var cosb = Math.cos(this.beta);
             var cosb = Math.cos(this.beta);
             var sinb = Math.sin(this.beta);
             var sinb = Math.sin(this.beta);
+            if (sinb === 0) {
+                sinb = 0.0001;
+            }
             var target = this._getTargetPosition();
             var target = this._getTargetPosition();
             target.addToRef(new BABYLON.Vector3(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb), this._newPosition);
             target.addToRef(new BABYLON.Vector3(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb), this._newPosition);
             if (this.getScene().collisionsEnabled && this.checkCollisions) {
             if (this.getScene().collisionsEnabled && this.checkCollisions) {

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/babylon.noworker.js


+ 3 - 0
src/Cameras/babylon.arcRotateCamera.js

@@ -484,6 +484,9 @@ var BABYLON;
             var sina = Math.sin(this.alpha);
             var sina = Math.sin(this.alpha);
             var cosb = Math.cos(this.beta);
             var cosb = Math.cos(this.beta);
             var sinb = Math.sin(this.beta);
             var sinb = Math.sin(this.beta);
+            if (sinb === 0) {
+                sinb = 0.0001;
+            }
             var target = this._getTargetPosition();
             var target = this._getTargetPosition();
             target.addToRef(new BABYLON.Vector3(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb), this._newPosition);
             target.addToRef(new BABYLON.Vector3(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb), this._newPosition);
             if (this.getScene().collisionsEnabled && this.checkCollisions) {
             if (this.getScene().collisionsEnabled && this.checkCollisions) {

+ 4 - 0
src/Cameras/babylon.arcRotateCamera.ts

@@ -533,6 +533,10 @@
             var cosb = Math.cos(this.beta);
             var cosb = Math.cos(this.beta);
             var sinb = Math.sin(this.beta);
             var sinb = Math.sin(this.beta);
 
 
+            if (sinb === 0) {
+                sinb = 0.0001;
+            }
+
             var target = this._getTargetPosition();
             var target = this._getTargetPosition();
             target.addToRef(new Vector3(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb), this._newPosition);
             target.addToRef(new Vector3(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb), this._newPosition);
             if (this.getScene().collisionsEnabled && this.checkCollisions) {
             if (this.getScene().collisionsEnabled && this.checkCollisions) {