ユニティ-フォローショットイージング効果Mathf.SmoothDamp()



Unity Follow Shot Easing Effect Mathf



Mathf.SmoothDamp関数を使用すると、時間の動きを追跡するためにそのようなカメラのバッファ効果が遅くなるときに、カメラがそのような動きの効果を緩和するようにすることができます。

public Transform target public float smoothTime = 0.2f private float xVelocity = 0 private float zVelocity = 0 void Update(){ float newPositionX = Mathf.SmoothDamp (transform.position.x, target.position.x, ref xVelocity, SmoothTime) float newPositionZ = Mathf.SmoothDamp (transform.position.z, target.position.z, ref zVelocity, SmoothTime) transform.position = new Vector3 (newPositionX, transform.position.y, newPositionZ) }

ここで、4つのパラメーター内のMathf.SmoothDamp(float、float target、)、特定のカメラ軸座標値を書き込む最初のfloat値タイプ、および2番目のターゲットが目標であるVelocityバッファリング速度? ? ? ? ?デフォルトは0で問題ありません。smoothTimeはバッファ時間であり、時間が速いほど時間が短くなります。