Rate of Change

Outputs how fast its input is changing, in units per second.

Parameters

NameTypeDescription
ValueoutputFloatHow much the input changes per second, positive when it is going up and negative when it is going down.
InputFloatThe value to measure.
SmoothingFloatHow many seconds the output takes to catch up with a new rate. 0 reports the raw rate.

Rate of Change measures how quickly its input moves. An input that rises by 2 every second gives 2, one that falls at that pace gives -2, and one that holds still gives 0. Fed with a position, it gives a speed.

Frame times are never exactly equal, so the raw rate tends to be jumpy even when the input moves evenly. Smoothing takes the jitter out by letting the output catch up with the measured rate over that many seconds rather than at once. A small smoothing of a tenth of a second is usually enough. It also means the output lags a little behind sudden changes.

A common use is to make something react to how fast a control is moved rather than to where it is, for example to add a glow that grows with the speed of a slider.

Keywords: velocity, speed, derivative, slope, delta, difference