Przeglądaj źródła

Fix issue when scaling is reapplied with BoundingBoxGizmo and GizmoManager

Cedric Guillemet 4 lat temu
rodzic
commit
641c451f8a

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

@@ -49,6 +49,7 @@
 - Fix ArcRotateCamera panning with axis decomposition ([CedricGuillemet](https://github.com/CedricGuillemet))
 - Fix an issue with keyboard control (re)attachment. ([#9411](https://github.com/BabylonJS/Babylon.js/issues/9411)) ([RaananW](https://github.com/RaananW))
 - Fix issue where PBRSpecularGlossiness materials were excluded from export [#9423](https://github.com/BabylonJS/Babylon.js/issues/9423)([Drigax](https://github.com/drigax))
+- Fix issue when scaling is reapplied with BoundingBoxGizmo and GizmoManager ([CedricGuillemet](https://github.com/CedricGuillemet))
 - Fix direct loading of a glTF string that has base64-encoded URI. ([bghgary](https://github.com/bghgary))
 - Fix crash of some node materials using instances on iOS ([Popov72](https://github.com/Popov72))
 - Fix the code generated for the NME gradient block ([Popov72](https://github.com/Popov72))

+ 2 - 0
src/Gizmos/boundingBoxGizmo.ts

@@ -376,6 +376,7 @@ export class BoundingBoxGizmo extends Gizmo {
         if (value) {
             // Reset anchor mesh to match attached mesh's scale
             // This is needed to avoid invalid box/sphere position on first drag
+            this._anchorMesh.scaling.setAll(1);
             PivotTools._RemoveAndStorePivotPoint(value);
             var originalParent = value.parent;
             this._anchorMesh.addChild(value);
@@ -438,6 +439,7 @@ export class BoundingBoxGizmo extends Gizmo {
             // Update bounding dimensions/positions
             var boundingMinMax = this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren, this.includeChildPredicate);
             boundingMinMax.max.subtractToRef(boundingMinMax.min, this._boundingDimensions);
+            console.log(this._boundingDimensions);
 
             // Update gizmo to match bounding box scaling and rotation
             // The position set here is the offset from the origin for the boundingbox when the attached mesh is at the origin