|
@@ -103480,6 +103480,10 @@ var BABYLON;
|
|
|
* If set, the drag plane/axis will be rotated based on the attached mesh's world rotation (Default: true)
|
|
|
*/
|
|
|
this.useObjectOrienationForDragging = true;
|
|
|
+ /**
|
|
|
+ * Predicate to determine if it is valid to move the object to a new position when it is moved
|
|
|
+ */
|
|
|
+ this.validateDrag = function (targetPosition) { return true; };
|
|
|
this._tmpVector = new BABYLON.Vector3(0, 0, 0);
|
|
|
this._alternatePickedPoint = new BABYLON.Vector3(0, 0, 0);
|
|
|
this._worldDragAxis = new BABYLON.Vector3(0, 0, 0);
|
|
@@ -103595,7 +103599,9 @@ var BABYLON;
|
|
|
_this._targetPosition.subtractToRef((_this._attachedNode).absolutePosition, _this._tmpVector);
|
|
|
_this._tmpVector.scaleInPlace(_this.dragDeltaRatio);
|
|
|
(_this._attachedNode).getAbsolutePosition().addToRef(_this._tmpVector, _this._tmpVector);
|
|
|
- (_this._attachedNode).setAbsolutePosition(_this._tmpVector);
|
|
|
+ if (_this.validateDrag(_this._tmpVector)) {
|
|
|
+ (_this._attachedNode).setAbsolutePosition(_this._tmpVector);
|
|
|
+ }
|
|
|
BABYLON.BoundingBoxGizmo._RestorePivotPoint(_this._attachedNode);
|
|
|
}
|
|
|
});
|