瀏覽代碼

fixedDragMeshScreenSize fix

Trevor Baron 6 年之前
父節點
當前提交
17838d7248
共有 2 個文件被更改,包括 16 次插入6 次删除
  1. 1 0
      dist/preview release/what's new.md
  2. 15 6
      src/Gizmos/babylon.boundingBoxGizmo.ts

+ 1 - 0
dist/preview release/what's new.md

@@ -70,6 +70,7 @@
 - CreateScreenshotUsingRenderTarget stretches mirror textures when setting both width and height ([TrevorDev](https://github.com/TrevorDev))
 - VR helper only updating vr cameras position when entering vr, rotation was missing ([TrevorDev](https://github.com/TrevorDev))
 - Fix VR controllers after gltfLoader transformNode change ([TrevorDev](https://github.com/TrevorDev))
+- Bounding Box fixedDragMeshScreenSize stopped working ([TrevorDev](https://github.com/TrevorDev))
 
 ### Core Engine
 - Fixed a bug with `mesh.alwaysSelectAsActiveMesh` preventing layerMask to be taken in account ([Deltakosh](https://github.com/deltakosh))

+ 15 - 6
src/Gizmos/babylon.boundingBoxGizmo.ts

@@ -312,6 +312,9 @@ module BABYLON {
                 // Only update the bouding box if scaling has changed
                 if (this.attachedMesh && !this._existingMeshScale.equals(this.attachedMesh.scaling)) {
                     this.updateBoundingBox();
+                }else if(this.fixedDragMeshScreenSize){
+                    this._updateRotationSpheres();
+                    this._updateScaleBoxes();
                 }
             });
             this.updateBoundingBox();
@@ -374,8 +377,17 @@ module BABYLON {
                 this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion);
                 this.attachedMesh.position.copyFrom(this._tmpVector);
             }
+            
+            this._updateRotationSpheres();
+            this._updateScaleBoxes();
+            
+            if (this.attachedMesh) {
+                this._existingMeshScale.copyFrom(this.attachedMesh.scaling);
+                BoundingBoxGizmo._RestorePivotPoint(this.attachedMesh);
+            }
+        }
 
-            // Update rotation sphere locations
+        private _updateRotationSpheres(){
             var rotateSpheres = this._rotateSpheresParent.getChildMeshes();
             for (var i = 0; i < 3; i++) {
                 for (var j = 0; j < 2; j++) {
@@ -409,8 +421,9 @@ module BABYLON {
                     }
                 }
             }
+        }
 
-            // Update scale box locations
+        private _updateScaleBoxes(){
             var scaleBoxes = this._scaleBoxesParent.getChildMeshes();
             for (var i = 0; i < 2; i++) {
                 for (var j = 0; j < 2; j++) {
@@ -433,10 +446,6 @@ module BABYLON {
                     }
                 }
             }
-            if (this.attachedMesh) {
-                this._existingMeshScale.copyFrom(this.attachedMesh.scaling);
-                BoundingBoxGizmo._RestorePivotPoint(this.attachedMesh);
-            }
         }
 
         /**