1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 09:16:02 +08:00

Fixed "toPath" orientation not working correctly with local paths

This commit is contained in:
Daniele Giardini 2015-04-29 01:10:38 +02:00
parent 520de672f3
commit d497fa9a6d
15 changed files with 6 additions and 3 deletions

View File

@ -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.0.635"; public static readonly string Version = "1.0.640";
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Options //////////////////////////////////// // Options ////////////////////////////////////

View File

@ -53,6 +53,9 @@ namespace DG.Tweening.Plugins
// then sets the final path version // then sets the final path version
public override void SetChangeValue(TweenerCore<Vector3, Path, PathOptions> t) public override void SetChangeValue(TweenerCore<Vector3, Path, PathOptions> t)
{ {
Transform trans = (Transform)t.target;
if (t.plugOptions.orientType == OrientType.ToPath && t.plugOptions.useLocalPosition) t.plugOptions.parent = trans.parent;
if (t.endValue.isFinalized) { if (t.endValue.isFinalized) {
t.changeValue = t.endValue; t.changeValue = t.endValue;
return; return;
@ -84,9 +87,7 @@ namespace DG.Tweening.Plugins
// Finalize path // Finalize path
path.FinalizePath(t.plugOptions.isClosedPath, t.plugOptions.lockPositionAxis, currVal); path.FinalizePath(t.plugOptions.isClosedPath, t.plugOptions.lockPositionAxis, currVal);
Transform trans = (Transform)t.target;
t.plugOptions.startupZRot = trans.eulerAngles.z; t.plugOptions.startupZRot = trans.eulerAngles.z;
if (t.plugOptions.orientType == OrientType.ToPath && t.plugOptions.useLocalPosition) t.plugOptions.parent = trans.parent;
// Set changeValue as a reference to endValue // Set changeValue as a reference to endValue
t.changeValue = t.endValue; t.changeValue = t.endValue;

View File

@ -676,6 +676,7 @@ namespace DG.Tweening
.SetTarget(target); .SetTarget(target);
t.plugOptions.mode = pathMode; t.plugOptions.mode = pathMode;
t.plugOptions.useLocalPosition = true;
return t; return t;
} }
// Used by path editor when creating the actual tween, so it can pass a pre-compiled path // Used by path editor when creating the actual tween, so it can pass a pre-compiled path
@ -697,6 +698,7 @@ namespace DG.Tweening
.SetTarget(target); .SetTarget(target);
t.plugOptions.mode = pathMode; t.plugOptions.mode = pathMode;
t.plugOptions.useLocalPosition = true;
return t; return t;
} }

Binary file not shown.