浏览代码

Merge pull request #5795 from TrevorDev/pointerDragSyncPlane

dragbehavior sync plane
David Catuhe 6 年之前
父节点
当前提交
c899ceddc7
共有 2 个文件被更改,包括 4 次插入0 次删除
  1. 1 0
      dist/preview release/what's new.md
  2. 3 0
      src/Behaviors/Meshes/pointerDragBehavior.ts

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

@@ -155,6 +155,7 @@
 - AmmoJS fix include issue caused after modules update and use world contact point to be consistent with oimo and cannon ([TrevorDev](https://github.com/TrevorDev)))
 - Warn of motor with maxForce in Oimo, cannonJS support no impostor, cannonJS cylinder axis, ammoJS wake up impostor when apply force/impulse ([TrevorDev](https://github.com/TrevorDev)))
 - Utility layer should render on last active camera ([TrevorDev](https://github.com/TrevorDev))
+- PointerDragBehavior should not let the drag plane get out of sync when rotating the object during dragging ([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))

+ 3 - 0
src/Behaviors/Meshes/pointerDragBehavior.ts

@@ -402,6 +402,9 @@ export class PointerDragBehavior implements Behavior<AbstractMesh> {
             this._dragPlane.position.copyFrom(this._pointA);
             this._dragPlane.lookAt(ray.origin);
         }
+        // Update the position of the drag plane so it doesn't get out of sync with the node (eg. when moving back and forth quickly)
+        this._dragPlane.position.copyFrom(this._attachedNode.absolutePosition);
+
         this._dragPlane.computeWorldMatrix(true);
     }