Dotween: Play to/from intermediate points on a path

Created on 4 May 2017  路  1Comment  路  Source: Demigiant/dotween

Is there a way to interpolate between two intermediate points on a path?

For example, I have 4 waypoints that describe a path for an animation.
I would like to tween an object between, let's say, 20% and 60% along the bezier.

Most helpful comment

Ok, so if anyone is interested, I figured out a way to do it:

GameObject _pathDummy = new GameObject();
_pathDummy.transform.position = path[0];

Tween _pathTween = _pathDummy.transform.DOPath(path, 1f, PathType.CatmullRom);
_pathTween.Pause();
_pathTween.ForceInit();

DOVirtual.Float(0.2f, 0.5f, 2f, f => {
    Vector3 point = _pathTween.PathGetPoint(f);

    object.transform.position = point;
});

I created a dummy object and a dummy path tween, so I can call PathGetPoint and get any point in the path.

Then I create a DOVirtual.Float tween, so I can get the eased float value, wich I use to get the point from the path and apply to the actual game object I want to animate.

>All comments

Ok, so if anyone is interested, I figured out a way to do it:

GameObject _pathDummy = new GameObject();
_pathDummy.transform.position = path[0];

Tween _pathTween = _pathDummy.transform.DOPath(path, 1f, PathType.CatmullRom);
_pathTween.Pause();
_pathTween.ForceInit();

DOVirtual.Float(0.2f, 0.5f, 2f, f => {
    Vector3 point = _pathTween.PathGetPoint(f);

    object.transform.position = point;
});

I created a dummy object and a dummy path tween, so I can call PathGetPoint and get any point in the path.

Then I create a DOVirtual.Float tween, so I can get the eased float value, wich I use to get the point from the path and apply to the actual game object I want to animate.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RealCosmik picture RealCosmik  路  9Comments

eduardbosch picture eduardbosch  路  3Comments

leeprobert picture leeprobert  路  5Comments

koblongata picture koblongata  路  9Comments

mrtenda picture mrtenda  路  4Comments