mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-20 17:26:03 +08:00
[bugfix] Fixed Unity bug with Vector3 comparison, which caused paths to generate an additional starting point in some cases even if the first waypoint and target position were equal
This commit is contained in:
parent
3aae3e29e7
commit
35920813c7
@ -168,6 +168,12 @@
|
||||
Returns the 2D angle between two vectors
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DG.Tweening.Core.Utils.Vector3AreApproximatelyEqual(UnityEngine.Vector3,UnityEngine.Vector3)">
|
||||
<summary>
|
||||
Uses approximate equality on each axis instead of Unity's Vector3 equality,
|
||||
because the latter fails (in some cases) when assigning a Vector3 to a transform.position and then checking it.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:DG.Tweening.Color2">
|
||||
<summary>
|
||||
Struct that stores two colors (used for LineRenderer tweens)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -168,6 +168,12 @@
|
||||
Returns the 2D angle between two vectors
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DG.Tweening.Core.Utils.Vector3AreApproximatelyEqual(UnityEngine.Vector3,UnityEngine.Vector3)">
|
||||
<summary>
|
||||
Uses approximate equality on each axis instead of Unity's Vector3 equality,
|
||||
because the latter fails (in some cases) when assigning a Vector3 to a transform.position and then checking it.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:DG.Tweening.Color2">
|
||||
<summary>
|
||||
Struct that stores two colors (used for LineRenderer tweens)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -168,6 +168,12 @@
|
||||
Returns the 2D angle between two vectors
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DG.Tweening.Core.Utils.Vector3AreApproximatelyEqual(UnityEngine.Vector3,UnityEngine.Vector3)">
|
||||
<summary>
|
||||
Uses approximate equality on each axis instead of Unity's Vector3 equality,
|
||||
because the latter fails (in some cases) when assigning a Vector3 to a transform.position and then checking it.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:DG.Tweening.Color2">
|
||||
<summary>
|
||||
Struct that stores two colors (used for LineRenderer tweens)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,29 +6,22 @@ using DG.Tweening;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class TempTests : BrainBase
|
||||
{
|
||||
public Transform target;
|
||||
Sequence seq;
|
||||
public Rigidbody target;
|
||||
|
||||
private void Awake()
|
||||
void Start()
|
||||
{
|
||||
// DOTween.Init();
|
||||
//
|
||||
// seq = DOTween.Sequence()
|
||||
// .OnComplete(()=> Debug.Log("COMPLETE"));
|
||||
// seq.AppendInterval(1);
|
||||
// seq.Append(target.DOMoveX(5, 1).OnComplete(()=> Debug.Log("Tween 0 complete")));
|
||||
// seq.AppendCallback(() => {
|
||||
// Debug.Log("Callback fired");
|
||||
// target.DOMoveX(-5, 1);
|
||||
// });
|
||||
target.DOMoveY(10, 0.3f).OnComplete(()=> {
|
||||
Debug.Log("complete");
|
||||
});
|
||||
}
|
||||
|
||||
seq = DOTween.Sequence();
|
||||
seq.AppendInterval(2)
|
||||
.Append(target.DOMoveX(100, 1))
|
||||
.AppendCallback(() => { target.DOMoveX(-50, 2); });
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Space)) SceneManager.LoadScene(SceneManager.GetActiveScene().name);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@ -33,6 +33,17 @@ namespace DG.Tweening.Core
|
||||
return ang;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uses approximate equality on each axis instead of Unity's Vector3 equality,
|
||||
/// because the latter fails (in some cases) when assigning a Vector3 to a transform.position and then checking it.
|
||||
/// </summary>
|
||||
internal static bool Vector3AreApproximatelyEqual(Vector3 a, Vector3 b)
|
||||
{
|
||||
return Mathf.Approximately(a.x, b.x)
|
||||
&& Mathf.Approximately(a.y, b.y)
|
||||
&& Mathf.Approximately(a.z, b.z);
|
||||
}
|
||||
|
||||
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
|
||||
// ███ INTERNAL CLASSES ████████████████████████████████████████████████████████████████████████████████████████████████
|
||||
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
|
||||
|
||||
@ -32,7 +32,7 @@ namespace DG.Tweening
|
||||
public class DOTween
|
||||
{
|
||||
/// <summary>DOTween's version</summary>
|
||||
public static readonly string Version = "1.1.620";
|
||||
public static readonly string Version = "1.1.625";
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Options ////////////////////////////////////
|
||||
|
||||
@ -69,7 +69,8 @@ namespace DG.Tweening.Plugins
|
||||
bool hasAdditionalStartingP = false, hasAdditionalEndingP = false;
|
||||
|
||||
// Create final wps and add eventual starting/ending waypoints
|
||||
if (path.wps[0] != currVal) {
|
||||
// if (path.wps[0] != currVal) {
|
||||
if (!Utils.Vector3AreApproximatelyEqual(path.wps[0], currVal)) {
|
||||
hasAdditionalStartingP = true;
|
||||
additionalWps += 1;
|
||||
}
|
||||
|
||||
@ -168,6 +168,12 @@
|
||||
Returns the 2D angle between two vectors
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DG.Tweening.Core.Utils.Vector3AreApproximatelyEqual(UnityEngine.Vector3,UnityEngine.Vector3)">
|
||||
<summary>
|
||||
Uses approximate equality on each axis instead of Unity's Vector3 equality,
|
||||
because the latter fails (in some cases) when assigning a Vector3 to a transform.position and then checking it.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:DG.Tweening.Color2">
|
||||
<summary>
|
||||
Struct that stores two colors (used for LineRenderer tweens)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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