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.
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.
Most helpful comment
Ok, so if anyone is interested, I figured out a way to do it:
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.