• Dampens a current value back to a target value with spring-damper behavior.

    Parameters

    • current: number

      the current value (usually position along an axis)

    • target: number

      the target value to dampen to

    • velocity: number

      the current velocity (usually speed along an axis)

    • smoothTime: number

      the time it should take to smoothen to the desired target

    • deltaTime: number

      the amount of time passed since last frame

    Returns [number, number]

    the smoothened value and new velocity: [position, velocity]