Simple Advice needed - Lerp, SmoothDamp, SmoothStep...... etc.
I simply want to lower a float when I press a button down and raise it when released. Of course I cannot just do this in increments being I need to consider the frame rate etc..
Testing these mathF Functions with no results after an hour is very monotonous. Any advice?
Answer by landon912 · Apr 11, 2016 at 12:35 PM
It depends on your desired behavior. Lerp is a linear interpolation, while SmoothStep and SmoothDamp are curve based interpolation. That is to say- Lerp has a constant rate of change, while SmoothXXXX flattens out near the limits.
With SmoothDamp, you provide it with an approximate target time to take to smooth out- you provide tell it to move in 1 second, and it will use whatever speed it needs(with respect to the maxSpeed) to get there closest to 1 second. With SmoothStep you give it a time percentage, in which you handle the speed.
Another difference is in that SmoothStep will gradually speed up from the start and slow down toward the end. Whereas, SmoothDamp works like a spring.
You'll need to choose which is best for your effect.
Answer by FullHeartGames · Apr 14, 2016 at 12:10 PM
Im not sure if im still going to use ths yet or not but my question is trying to find the right function for my solution. Basically hold a button and float lowers at steady rate down to like '1' and let go and it rises back to original number at the same rate.
Your answer
Follow this Question
Related Questions
Weapon does't meet the target position when using IK 1 Answer
Smooth camera to target Y-height 3 Answers
Final position of the camera movement 0 Answers
MoveTowards and Lerp not working 1 Answer