0
\$\begingroup\$

i'm trying to create a smothstop function i need it to control time variable on my lerp function used to move character and so on...what i have is this

    private float SmothStop(float t)
{
    return  1 - (1 - t * t * t * t * t);

}

problem here is that will start slow then accelerate... same as smothstart function.. that i already tested and work on that way.. so.. what i'm missing up?

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

Look what happens when we multiply through the parentheses here:

  1 - (1 - t * t * t * t * t)
= 1 - 1 + t * t * t * t * t
= t * t * t * t * t

So you just re-wrote SmoothStart in disguise.

It looks like what you want is:

float s = 1f - t;

return 1 - s * s * s * s * s;

When t is close to 1, s is close to zero. Raising to the 5th power creates a shallow slope around s = 0 (t = 1), and a steep slope around s = 1 (t = 0). Subtracting from 1 ensures the function is still increasing from 0 to 1 as t increases from 0 to 1.

\$\endgroup\$
1
  • \$\begingroup\$ Thank’s uou really so much! I got the pont! \$\endgroup\$
    – mirkojpn
    Commented Jun 30, 2019 at 3:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .