1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2026-02-12 18:18:56 +08:00

DOBlendableLocalRotation fix

This commit is contained in:
Daniele Giardini 2015-03-27 18:13:22 +01:00
parent 40dbd39b0e
commit d51af7ee07
9 changed files with 2 additions and 2 deletions

View File

@ -692,11 +692,11 @@ 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.rotation; Quaternion to = target.localRotation;
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => to, x => { TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => to, x => {
Quaternion diff = x * Quaternion.Inverse(to); Quaternion diff = x * Quaternion.Inverse(to);
to = x; to = x;
target.rotation = target.rotation * Quaternion.Inverse(target.rotation) * diff * target.rotation; target.localRotation = target.localRotation * Quaternion.Inverse(target.localRotation) * diff * target.localRotation;
}, byValue, duration) }, byValue, duration)
.Blendable().SetTarget(target); .Blendable().SetTarget(target);
t.plugOptions.rotateMode = mode; t.plugOptions.rotateMode = mode;

Binary file not shown.