mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-20 09:16: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 class TempTests : BrainBase
|
||||||
{
|
{
|
||||||
public Transform target;
|
public Transform target;
|
||||||
Tween myTween;
|
public Transform rotTarget;
|
||||||
void Start()
|
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()
|
target.DORotateQuaternion(rotTarget.rotation, 2).SetEase(easeType);
|
||||||
{
|
|
||||||
if (Input.GetKey(KeyCode.J))
|
|
||||||
{
|
|
||||||
DOTween.timeScale -= 0.1f;
|
|
||||||
}
|
|
||||||
if (Input.GetKey(KeyCode.K))
|
|
||||||
{
|
|
||||||
DOTween.timeScale += 0.1f;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Log(DOTween.timeScale);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
@ -66,10 +66,11 @@ namespace DG.Tweening.CustomPlugins
|
|||||||
/// <summary>INTERNAL: do not use</summary>
|
/// <summary>INTERNAL: do not use</summary>
|
||||||
public override void SetChangeValue(TweenerCore<Quaternion, Quaternion, NoOptions> t)
|
public override void SetChangeValue(TweenerCore<Quaternion, Quaternion, NoOptions> t)
|
||||||
{
|
{
|
||||||
t.changeValue.x = t.endValue.x - t.startValue.x;
|
// t.changeValue.x = t.endValue.x - t.startValue.x;
|
||||||
t.changeValue.y = t.endValue.y - t.startValue.y;
|
// t.changeValue.y = t.endValue.y - t.startValue.y;
|
||||||
t.changeValue.z = t.endValue.z - t.startValue.z;
|
// t.changeValue.z = t.endValue.z - t.startValue.z;
|
||||||
t.changeValue.w = t.endValue.w - t.startValue.w;
|
// 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>
|
/// <summary>INTERNAL: do not use</summary>
|
||||||
@ -87,11 +88,12 @@ namespace DG.Tweening.CustomPlugins
|
|||||||
// * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops);
|
// * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops);
|
||||||
// }
|
// }
|
||||||
float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);
|
float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);
|
||||||
startValue.x += changeValue.x * easeVal;
|
setter(Quaternion.Slerp(startValue, changeValue, easeVal));
|
||||||
startValue.y += changeValue.y * easeVal;
|
// startValue.x += changeValue.x * easeVal;
|
||||||
startValue.z += changeValue.z * easeVal;
|
// startValue.y += changeValue.y * easeVal;
|
||||||
startValue.w += changeValue.w * easeVal;
|
// startValue.z += changeValue.z * easeVal;
|
||||||
setter(startValue);
|
// startValue.w += changeValue.w * easeVal;
|
||||||
|
// setter(startValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ namespace DG.Tweening
|
|||||||
public class DOTween
|
public class DOTween
|
||||||
{
|
{
|
||||||
/// <summary>DOTween's version</summary>
|
/// <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 ////////////////////////////////////
|
// Options ////////////////////////////////////
|
||||||
|
|||||||
@ -576,9 +576,9 @@ namespace DG.Tweening
|
|||||||
/// (neither for itself nor if placed inside a LoopType.Incremental Sequence)</para>
|
/// (neither for itself nor if placed inside a LoopType.Incremental Sequence)</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
/// <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);
|
t.SetTarget(target);
|
||||||
return t;
|
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