Smooth expression

From Castle Wiki
Revision as of 13:49, 19 October 2022 by Ben (talk | contribs) (add smooth expression)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The smooth expression returns a value which is smoothed over time.

Given a number that changes over time, N(t), and a smoothing parameter, this expression updates its output Y each step with the following:

Y(0) = N(0)
Y(t) = Y(t - 1) + dt * (N(t) - Y(t - 1)) / smoothing