Version: 2018.2
public static float SmoothDamp (float current, float target, ref float currentVelocity, float smoothTime, float maxSpeed= Mathf.Infinity, float deltaTime= Time.deltaTime);

パラメーター

current現在位置
target目的地
currentVelocity現在の速度。この値は関数が呼び出されるたびに変更されます。
smoothTimetarget へ到達するまでのおおよその時間。値が小さいほど、target に速く到達します。
maxSpeedオプションとして、最大速度を制限することができます。
deltaTimeこの関数が最後に呼び出されてからの経過時間。デフォルトは Time.deltaTime 変数。

説明

徐々に時間をかけて望む目標に向かって値を変更します。

The value is smoothed by some spring-damper like function, which will never overshoot. The function can be used to smooth any kind of value, positions, colors, scalars.

using UnityEngine;

public class Example : MonoBehaviour { // Smooth towards the height of the target

Transform target; float smoothTime = 0.3f; float yVelocity = 0.0f;

void Update() { float newPosition = Mathf.SmoothDamp(transform.position.y, target.position.y, ref yVelocity, smoothTime); transform.position = new Vector3(transform.position.x, newPosition, transform.position.z); } }