1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 17:26:03 +08:00

[bugfix] Fix for DOBlendableRotateBy/DOBlendableLocalRotateBy working as absolute instead of relative rotations

This commit is contained in:
Demigiant 2017-02-09 11:11:47 +01:00
parent d8e1dbf5f0
commit 37fef411db
48 changed files with 52 additions and 12 deletions

View File

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class BlendableTweens_Rotation : BrainBase
{
public Transform targetRotate, targetLocalRotate;
public void BlendableRotateX()
{
targetRotate.DOBlendableRotateBy(new Vector3(10, 0, 0), 1);
targetLocalRotate.DOBlendableLocalRotateBy(new Vector3(10, 0, 0), 1);
}
public void BlendableRotateY()
{
targetRotate.DOBlendableRotateBy(new Vector3(0, 10, 0), 1);
targetLocalRotate.DOBlendableLocalRotateBy(new Vector3(0, 10, 0), 1);
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d6132359ece035a4995c4859a13e95e3
timeCreated: 1486634495
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1942483936857a24e90c22cb67ac5c6b
timeCreated: 1486634480
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -13,16 +13,13 @@ public class TempTests : BrainBase
{ {
public Transform target; public Transform target;
IEnumerator Start() public void BlendableRotateX()
{ {
Tween t = target.DORotate(new Vector3(0, 0, 90), 0.5f, RotateMode.LocalAxisAdd).SetEase(Ease.Linear) target.DOBlendableRotateBy(new Vector3(10, 0, 0), 1);
.SetAutoKill(false).Pause(); }
t.SetUpdate(true);
t.OnUpdate(()=> Debug.Log("UPDATE " + t.Elapsed() + "/" + t.IsPlaying()));
yield return new WaitForSeconds(0.5f);
t.Complete(); public void BlendableRotateY()
// t.Rewind(); {
t.PlayBackwards(); target.DOBlendableRotateBy(new Vector3(0, 10, 0), 1);
} }
} }

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.1.555"; public static readonly string Version = "1.1.560";
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Options //////////////////////////////////// // Options ////////////////////////////////////

View File

@ -1178,7 +1178,8 @@ namespace DG.Tweening
/// <param name="mode">Rotation mode</param> /// <param name="mode">Rotation mode</param>
public static Tweener DOBlendableRotateBy(this Transform target, Vector3 byValue, float duration, RotateMode mode = RotateMode.Fast) public static Tweener DOBlendableRotateBy(this Transform target, Vector3 byValue, float duration, RotateMode mode = RotateMode.Fast)
{ {
Quaternion to = target.rotation; // Quaternion to = target.rotation;
Quaternion to = Quaternion.identity;
TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => to, x => { TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => to, x => {
#if COMPATIBLE #if COMPATIBLE
Quaternion diff = x.value * Quaternion.Inverse(to); Quaternion diff = x.value * Quaternion.Inverse(to);
@ -1201,7 +1202,8 @@ namespace DG.Tweening
/// <param name="mode">Rotation mode</param> /// <param name="mode">Rotation mode</param>
public static Tweener DOBlendableLocalRotateBy(this Transform target, Vector3 byValue, float duration, RotateMode mode = RotateMode.Fast) public static Tweener DOBlendableLocalRotateBy(this Transform target, Vector3 byValue, float duration, RotateMode mode = RotateMode.Fast)
{ {
Quaternion to = target.localRotation; // Quaternion to = target.localRotation;
Quaternion to = Quaternion.identity;
TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => to, x => { TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => to, x => {
#if COMPATIBLE #if COMPATIBLE
Quaternion diff = x.value * Quaternion.Inverse(to); Quaternion diff = x.value * Quaternion.Inverse(to);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.