mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-20 01:06:02 +08:00
[BUGFIX] Fixed DORotateQuaternion not always choosing the shortest path
This commit is contained in:
parent
d3cc8ea625
commit
444fff8aba
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -12,23 +12,13 @@ using UnityEngine.UI;
|
||||
public class TempTests : BrainBase
|
||||
{
|
||||
public Transform target;
|
||||
Tween myTween;
|
||||
void Start()
|
||||
public Transform rotTarget;
|
||||
public Ease easeType = Ease.Linear;
|
||||
|
||||
IEnumerator Start()
|
||||
{
|
||||
myTween = target.DOMove(new Vector3(5, 5, 5), 25).SetAutoKill(false).SetUpdate(true);
|
||||
}
|
||||
yield return new WaitForSeconds(1);
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKey(KeyCode.J))
|
||||
{
|
||||
DOTween.timeScale -= 0.1f;
|
||||
}
|
||||
if (Input.GetKey(KeyCode.K))
|
||||
{
|
||||
DOTween.timeScale += 0.1f;
|
||||
}
|
||||
|
||||
Debug.Log(DOTween.timeScale);
|
||||
target.DORotateQuaternion(rotTarget.rotation, 2).SetEase(easeType);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@ -66,10 +66,11 @@ namespace DG.Tweening.CustomPlugins
|
||||
/// <summary>INTERNAL: do not use</summary>
|
||||
public override void SetChangeValue(TweenerCore<Quaternion, Quaternion, NoOptions> t)
|
||||
{
|
||||
t.changeValue.x = t.endValue.x - t.startValue.x;
|
||||
t.changeValue.y = t.endValue.y - t.startValue.y;
|
||||
t.changeValue.z = t.endValue.z - t.startValue.z;
|
||||
t.changeValue.w = t.endValue.w - t.startValue.w;
|
||||
// t.changeValue.x = t.endValue.x - t.startValue.x;
|
||||
// t.changeValue.y = t.endValue.y - t.startValue.y;
|
||||
// t.changeValue.z = t.endValue.z - t.startValue.z;
|
||||
// t.changeValue.w = t.endValue.w - t.startValue.w;
|
||||
t.changeValue = t.endValue; // Special case where changeValue is equal to endValue so it can be applied better
|
||||
}
|
||||
|
||||
/// <summary>INTERNAL: do not use</summary>
|
||||
@ -87,11 +88,12 @@ namespace DG.Tweening.CustomPlugins
|
||||
// * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops);
|
||||
// }
|
||||
float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);
|
||||
startValue.x += changeValue.x * easeVal;
|
||||
startValue.y += changeValue.y * easeVal;
|
||||
startValue.z += changeValue.z * easeVal;
|
||||
startValue.w += changeValue.w * easeVal;
|
||||
setter(startValue);
|
||||
setter(Quaternion.Slerp(startValue, changeValue, easeVal));
|
||||
// startValue.x += changeValue.x * easeVal;
|
||||
// startValue.y += changeValue.y * easeVal;
|
||||
// startValue.z += changeValue.z * easeVal;
|
||||
// startValue.w += changeValue.w * easeVal;
|
||||
// setter(startValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -32,7 +32,7 @@ namespace DG.Tweening
|
||||
public class DOTween
|
||||
{
|
||||
/// <summary>DOTween's version</summary>
|
||||
public static readonly string Version = "1.2.226"; // Last version before modules: 1.1.755
|
||||
public static readonly string Version = "1.2.230"; // Last version before modules: 1.1.755
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Options ////////////////////////////////////
|
||||
|
||||
@ -576,9 +576,9 @@ namespace DG.Tweening
|
||||
/// (neither for itself nor if placed inside a LoopType.Incremental Sequence)</para>
|
||||
/// </summary>
|
||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||
public static TweenerCore<Quaternion, Quaternion, NoOptions> DORotateQuaternion(this Transform target, Quaternion endValue, float duration)
|
||||
public static TweenerCore<DOQuaternion, DOQuaternion, NoOptions> DORotateQuaternion(this Transform target, Quaternion endValue, float duration)
|
||||
{
|
||||
TweenerCore<Quaternion, Quaternion, NoOptions> t = DOTween.To(PureQuaternionPlugin.Plug(), () => target.rotation, x => target.rotation = x, endValue, duration);
|
||||
TweenerCore<DOQuaternion, DOQuaternion, NoOptions> t = DOTween.To(PureQuaternionPlugin.Plug(), () => target.rotation, x => target.rotation = x, endValue, duration);
|
||||
t.SetTarget(target);
|
||||
return t;
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user