DOTween (HOTween v2), a Unity tween engine

v0.7.220 released.

It adds LoopType.Incremental, DOTween.ClearCachedTweens, and now IsTweening returns a bool.

I’ve found the first bug: Google Code Archive - Long-term storage for Google Code Project Hosting.
I hope this time is a real bug

Congratulations for finding the first bug! :slight_smile: And yes, it was indeed a bug (which also led me to find another different one, so it was doubly cool).

I fixed it in the latest v0.7.225.

Nice, thank you for the response. Just changing end values seems very simple and powerful, especially with snapStartValue.

The API on your site has the DOTween static public attributes’ default values (for example defaultAutoKill = true), but they don’t show on Visual Studio intellisense tooltips for some reason. :confused:

And, PlayBackwards and PlayForward descriptions are mixed. :slight_smile: Also, as with HOTween, the former has an “s” at the end (as I think it should) while the latter doesn’t. adverbs - Forward vs Forwards - English Language & Usage Stack Exchange

Does ChangeEndValue return void intentionally? Otherwise one could chain it with a Play call after it… Sorry for nitpicking like this :frowning:

1 Like

DORotate doesn’t seem to support passing in Quaternions as the destination value and trying to use DOTween.To() with Quaternions gives me the following error in the editor:

Cannot implicitly convert type UnityEngine.Quaternion' to float’

And in Visual Studio, it says:

Cannot resolve method ‘TO(lambda expression, lambda expression, UnityEngine.Quaternion, float)’

I’m using DOTween version 0.7.255

@neonblitzer I love nitpicking so go for it, and thanks for pointing out the XML comments corrections.

About Forward/s and Backward/s you’re totally right, and indeed they are PlayForward and PlayBackwards as in HOTween: I erroneously added an S to Forward only on the website docs (or were you saying the opposite, meaning I should add an S even to Forward? that seems wrong to me, though even that link you sent is kind of confusing on the subject).

About intelliSense and DOTween.defaultAutoKill (or others) can you tell me more? I see those static properties and their description both with Visual Studio’s intelliSense and with MonoDevelop’s, so it’s weird that you don’t. You don’t see those properties at all, or you see them without a description?

@Jeiel DORotate wants a Vector3 (both because like that it’s easier to pass custom rotations and because internally Quaternions are rotated as Vector3). If you really want to pass a Quaternion, just pass myQuaternion.eulerAngles instead.

P.S. forgot to mention… new version 0.7.255 is out, with the changes/fixes reported by @neonblitzer :slight_smile:

This looks really great! I just have one question, is it ok to use the transform tween on kinematic rigidbodies with colliders? Or would it be better to tween a vector / float value with moveRotation in fixed update?

Hi Rich. Should be ok, as long as it’s kinematic and no physics mess up the animations.

Loving the new stuff! I’m not sure if you’ve played with your own plugin much yet, but I was trying some experiments specifically with the ChangeEndValue, because I think it’s the most powerful addition, anyway. What would, in your opinion, be the best way to make a cube follow another cube purely via DOTween? I tried a very witty approach, but it threw a stack overflow on me.:

Tweener tweener = transfrom.DOMove (Target.position, 1).SetSpeedBased ();
tweener.OnUpdate (() => tweener.ChangeEndValue (Target.position, true));

In any case, thanks a LOT for a second iteration of this amazing plugin, I can’t stress enough how amazingly easy it makes animations for a dumb programmer like myself!

Hey Dávid! Glad you like it :slight_smile: And I did that exact same test, but instead than using OnUpdate I used Unity’s Update to have an object follow the mouse. With your way you found a bug where OnUpdate is called when it shouldn’t and thus generates a stack overflow. It’s an easy fix and I’ll do that tomorrow morning among other things (going to bed now).

Ok, thanks for the quick response…

I tried it out and it does work well and seems much faster than itween, but I have encountered a small problem.

I am using DoTween to move a series of platforms in a game. If I use the transform.DoMove shortcuts then the rigidbody character doesn’t move with the platform (sort of slides on top). I think this is to do with rigidbodies should ideally be moved with the MovePosition command instead, so I used the float method and OnUpdate to call a function that uses the MovePosition to adjust its position. This does move the rigidbody character with the platform as expected, but I was wondering maybe a good feature would be to check if a gameobject has a rigidbody attached and if so to use the MovePosition / MoveRotation methods instead?

Thanks

Rich

@RichHurst Good point Rich. I put it in my TODO list and will add it soon.

@DavidDebnar I went to fix that OnUpdate “issue”, and realized that instead it’s intended behaviour. I mean, you do want OnUpdate to be called when you change a start/end value, since a rewind happens and you might have other things to control related to that update, so preventing that to happen would not be good. Instead, I suggest you use Unity’s Update to do a follow routine like that :slight_smile:

P.S. in the meantime there’s a new DOTween version, which fixes a couple bugs

You can fix this with a quick shortcut :wink:

using UnityEngine;
using DG.Tweening;

public static class RigidbodyShortcutExtensions
{
    public static Tweener DOMove (this Rigidbody rigidbody, Vector3 endValue, float duration)
    {
        return DOTween.To (() => rigidbody.position, rigidbody.MovePosition, endValue, duration).SetId (rigidbody);
    }
}

Thanks, I did just that :wink:

New DOTween update implements rigidbody shortcuts.

Wow, thanks to both of you! This is really developing fast and looking great!

Thanks once again.

Just thought I’d let you know, I’ve now implemented the new version and it works really well (much faster than my crude implementation).

I have another question / suggestion, would there be a way to have a delay option that works on the completion of each step, currently I am using the OnStepComplete to call a function that calls a coroutine that pauses the tween, waits for a given time and then resumes the tween. This works, but I imagine its not the most efficient way of doing it…

I realise its probably quite a niche request, but i’d imagine its quite useful for people trying to implement platform tweens.

Thanks

Rich

You could use a Sequence for this.

OK, thanks… I’ll look into using that instead.

I might be doing something wrong (more than likely), but I couldn’t get the DoLocalRotate to be rotating in local space?