DOTween, Path Percentage Animations

HI there

I have a question in regards to DOTween that i hope someone can asnwer.

  1. I have a Tweener tw, cached as a DOPath().
  2. In the game, I am collecting a percentage point.
  3. I want the transform to move to animate to this percentage point.

What appears to be happening is the transform snaps its position to the end percentage and then continues to play from there to the end of the path itslef. This is incorrect for my needs. I need to be able to move from and to any percentage values. Ex (from 0.1 to 0.8) or (from 0.8 to 0.1)

So how can I achieve this, if at all?
Thanks!

Isolate your tweener thingy and feed it known values ascending from 0.0 to 1.0, make sure that works 100% first.

float cyclingFraction = Time.time % 1.0f;  // 0.0 to 1.0, again and again

Feed that in, see what it does.

Also , are you dividing integer counts? They need to be coerced up to float to give fractional results.

int a = 5;
int b = 10;

float c = a / b;

// you'll be amazed at what c is right now!

// try this instead:

c = (float)a / b;

// aaah, c is much better now
1 Like