Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ChaosHill

Pages: [1]
1
DOTween & DOTween Pro / Noob question
« on: May 05, 2016, 05:50:12 AM »
Hi,

I am somewhat new to DOTween and have been trying to migrate from Unity's animation system to this one.
I have a simple animation sequence that I want to have in my game, it goes as follows:

Code: [Select]
m_MoveLeft = DOTween.Sequence();
        m_MoveLeft.Insert(0.0f, m_PlayerModel.DOScale(new Vector3(1.25f, 0.8f, 1.0f), 0.05f));
        m_MoveLeft.Insert(0.05f, m_PlayerModel.DOScale(new Vector3(1.0f, 1.0f, 1.0f), 0.2f));

        Vector3[] _path = new Vector3[5];
        _path[0] = new Vector3(0.0f, 0.0f, 0.0f);
        _path[1] = new Vector3(-.5f, 0.35f, 0.0f);
        _path[2] = new Vector3(-1.0f, 0.55f, 0.0f);
        _path[3] = new Vector3(-1.5f, 0.35f, 0.0f);
        _path[4] = new Vector3(-2.0f, 0.0f, 0.0f);

        m_MoveLeft.Insert(0.0f, m_PlayerModel.DOPath(_path, 0.5f, PathType.CatmullRom, PathMode.Ignore).SetRelative().SetEase(Ease.Linear));

This works fine if I play it once. But once the animation is done the player is in a different spot and if I try to move left again the sequence restarts from the original position and not the new position. Through research I found out a sequence is like a movie and therefore, static in nature. The points won't change once they are set. And that's exactly the opposite of what I am trying to do.

Now to the questions.
Is there a way to do what I want using sequences? Having changing start and end positions to them?
If not, how can  I accomplish something similar with a Tweener? Should I be chaining callbacks after each tween is done? That does not seem correct at all to me.

Anyway, thanks for taking the time!

Pages: [1]