April 25, 2014

The Subtle Magic of InterpTo()

By Jeff Farris

There’s a certain amount of craftsmanship involved in making things move around algorithmically.  Getting a camera to slide smoothly into position, gliding on the gossamer wings of math, can be a perilous underataking.  One wrong wobble, one tiny pop, and every pixel on the screen becomes wrong, the needle slides off the record, and the magic spell is broken.

Enter one of my favorite tools in the Unreal Engine toolbox: the InterpTo() functions, available in C++ or in Blueprints.

Programming screenshot

Blueprints Screenshot

They exhibit fast exit behavior, accelerating instantly.  They have a silky smooth arrival characteristic, and they terminate without a noticeable pop in a reasonable timeframe.

They’re great for smoothing out discontinuities.  They can deliver a sense of momentum and “weight”.

They’re perfect for interpolations with an indeterminate endpoint.  Try setting up a “pursuit” scenario – your actual value ever-interpolating toward the ideal goal value – and you’ll get a satisfying and highly tunable “flexiness”.

They’re framerate-independent. Enough, anyway.

They’re fun at parties.

In short, they’re a valuable tool in the Unreal Engine toolbox and worth getting to know. And as always, if you have any questions or inspiring interpolation-related anecdotes to share, drop by the forums!