smoothDamp

fun Number.smoothDamp(target: Number, currentVelocity: Reference<Double>, smoothTime: Measure<Time>, maxVelocity: Number, deltaTime: Measure<Time>): Double

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

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.


fun Measure<Angle>.smoothDamp(target: Measure<Angle>, currentVelocity: Reference<Double>, smoothTime: Measure<Time>, maxVelocity: Number, deltaTime: Measure<Time>): Measure<Angle>

Gradually changes an angle towards a desired goal over time.

Return

The new angle following the smooth damp. The new ang. 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

target

The angle we want to be at.

currentVelocity

The current angular 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.