Needle Engine

Changes between version 3.44.2 and 3.44.3
Files changed (2) hide show
  1. src/engine-components/AnimatorController.ts +3 -1
  2. src/engine-components/DragControls.ts +4 -2
src/engine-components/AnimatorController.ts CHANGED
@@ -413,7 +413,9 @@
413
413
 
414
414
  let makeTransition = false;
415
415
  if (transition.hasExitTime) {
416
- makeTransition = normalizedTime >= exitTime;
416
+ if (action.timeScale > 0) makeTransition = normalizedTime >= transition.exitTime;
417
+ // When the animation is playing backwards we need to check exit time inverted
418
+ else if (action.timeScale < 0) makeTransition = 1 - normalizedTime >= transition.exitTime;
417
419
  }
418
420
  else {
419
421
  makeTransition = true;
src/engine-components/DragControls.ts CHANGED
@@ -963,9 +963,11 @@
963
963
  if (hit.face) {
964
964
  const dragTimeThreshold = 0.15;
965
965
  const dragTimeSatisfied = this._draggedOverObjectDuration >= dragTimeThreshold;
966
+ const dragDistance = 0.001;
967
+ const dragDistanceSatisfied = this._totalMovement.length() >= dragDistance;
966
968
  // Adjust drag plane if we're dragging over a different object (for a certain amount of time)
967
969
  // or if the surface normal changed
968
- if (dragTimeSatisfied &&
970
+ if ((dragTimeSatisfied || dragDistanceSatisfied) &&
969
971
  (this._draggedOverObjectLastSetUp !== this._draggedOverObject
970
972
  || this._draggedOverObjectLastNormal.dot(hit.face.normal) < 0.999999
971
973
  // if we're dragging on a flat surface with different levels (like the sandbox floor)
@@ -1004,7 +1006,7 @@
1004
1006
  // we want to return here and wait until the drag has been going on for a bit
1005
1007
  // Otherwise the object will either immediately change it's position (when the user starts dragging)
1006
1008
  // Or interpolate to a wrong position for a short moment
1007
- else if (!dragTimeSatisfied) {
1009
+ else if (!(dragTimeSatisfied || dragDistanceSatisfied)) {
1008
1010
  return;
1009
1011
  }
1010
1012
  }