smoothDamp

open fun smoothDamp(current: Double, target: Double, @NonNull currentVelocity: Reference<Double>, smoothTime: Measure<Time>, maxVelocity: Double, deltaTime: Measure<Time>): Double
open fun smoothDamp(current: Float, target: Float, currentVelocity: Reference<Double>, smoothTime: Measure<Time>, maxVelocity: Float, deltaTime: Measure<Time>): Float

Gradually changes a value towards a desired goal over time.

Return

The new position following the smooth damp. The new velocity is stored in the currentVelocity reference, for when this method is called again. Any clamping of this value to minimum limits is left to your discretion.

Parameters

current

The current position.

target

The position we want to be at.

currentVelocity

The current velocity of the current position moving towards the target. This ref is modified by this function and should be passed back into it on subsequent calls.

smoothTime

Approximately the time it will take to reach the target.

maxVelocity

The maximum velocity that may be achieved when moving current->target.

deltaTime

The time since the last call to this method.