カメラのオブジェクトはプライヤーの「Child」オブジェクトを設定する
この方法は動きの設定ができない、プライヤー全部変更の動きはカメラも変更されている。
この動きが3つうごきがあります。
・Transform。
・Scale
・Rotate
カメラで新しいスクリプトファイルを作る
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class followPlayer : MonoBehaviour {
public Transform player;
public Vector3 offset;
// Update is called once per frame
void Update () {
transform.position = player.position + offset;
}
}
↑のコードを使ってそのカメラはプライヤーの動くをコピーすることができる。
transform.position = player.position + offset;
↑のコードはその「Transform」の動きをコピーするためのコードです。