Browse Source

Merge pull request #6592 from TrevorDev/bugFixesForGizmos

Make planeDragGizmo usable on its own, Fix useObjectOrienationForDrag…
David Catuhe 6 years ago
parent
commit
ca0a949364

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

@@ -100,6 +100,8 @@
 - Loading the same multi-material twice and disposing one should not impact the other ([TrevorDev](https://github.com/TrevorDev))
 - GLTF exporter should no longer duplicate exported texture data ([Drigax](https://github.com/Drigax))
 - Avoid exception when disposing of Ammo cloth physics ([TrevorDev](https://github.com/TrevorDev))
+- Make planeDragGizmo usable on its own ([TrevorDev](https://github.com/TrevorDev))
+- Fix useObjectOrienationForDragging for pointerDragBehavior when using a single axis drag ([TrevorDev](https://github.com/TrevorDev))
 
 ## Breaking changes
 - Setting mesh.scaling to a new vector will no longer automatically call forceUpdate (this should be done manually when needed) ([TrevorDev](https://github.com/TrevorDev))

+ 2 - 2
src/Behaviors/Meshes/pointerDragBehavior.ts

@@ -314,8 +314,8 @@ export class PointerDragBehavior implements Behavior<AbstractMesh> {
             var dragLength = 0;
             // depending on the drag mode option drag accordingly
             if (this._options.dragAxis) {
-                // Convert local drag axis to world
-                Vector3.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._worldDragAxis);
+                // Convert local drag axis to world if useObjectOrienationForDragging
+                this.useObjectOrienationForDragging ? Vector3.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._worldDragAxis) : this._worldDragAxis.copyFrom(this._options.dragAxis);
 
                 // Project delta drag from the drag plane onto the drag axis
                 pickedPoint.subtractToRef(this.lastDragPosition, this._tmpVector);

+ 2 - 1
src/Gizmos/index.ts

@@ -7,4 +7,5 @@ export * from "./planeRotationGizmo";
 export * from "./positionGizmo";
 export * from "./rotationGizmo";
 export * from "./scaleGizmo";
-export * from "./lightGizmo";
+export * from "./lightGizmo";
+export * from "./planeDragGizmo";