*Vector3.Lerp関数の設定
・「ChaseCamera」スクリプトの中身を下記のように修正する。
using UnityEngine;
using System.Collections;
public class ChaseCamera : MonoBehaviour {
public GameObject target;
private Vector3 offset;
// ★追加
public float followSpeed;
void Start () {
offset = transform.position - target.transform.position;
}
// ★修正
void LateUpdate () {
// ★線形補間関数によるスムージング
transform.position = Vector3.Lerp(transform.position, target.transform.position + offset, Time.deltaTime * followSpeed);
}
}
・速度(follow speed)を設定
・設定が完了したら再生ボタンを押して、どのようにカメラが追いかけるかを確認してみましょう。
