瀏覽代碼

do not allow bounding box scaling to invert

Trevor Baron 7 年之前
父節點
當前提交
f7cb4ed514
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/Gizmos/babylon.boundingBoxGizmo.ts

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

@@ -182,8 +182,12 @@ module BABYLON {
                                 
                                 // Update scale and position
                                 this.attachedMesh.scaling.addInPlace(deltaScale);
-                                this.attachedMesh.getAbsolutePosition().addToRef(worldMoveDirection, this._tmpVector)
-                                this.attachedMesh.setAbsolutePosition(this._tmpVector);
+                                if(this.attachedMesh.scaling.x < 0 || this.attachedMesh.scaling.y < 0 || this.attachedMesh.scaling.z < 0){
+                                    this.attachedMesh.scaling.subtractInPlace(deltaScale);
+                                }else{
+                                    this.attachedMesh.getAbsolutePosition().addToRef(worldMoveDirection, this._tmpVector)
+                                    this.attachedMesh.setAbsolutePosition(this._tmpVector);
+                                }
                             }
                         })