123456789101112131415161718192021222324252627 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class FollowCenterCamera : MonoBehaviour
- {
- public GameObject cameraObj;
- // Start is called before the first frame update
- void Start()
- {
- DontDestroyOnLoad(this.gameObject);
- }
- Queue<Vector3> posq = new Queue<Vector3>();
- Queue<Vector3> eulq = new Queue<Vector3>();
- // Update is called once per frame
- void Update()
- {
- if(posq.Count>3)
- {
- this.transform.position = posq.Dequeue();
- this.transform.eulerAngles = eulq.Dequeue();
- }
- posq.Enqueue(cameraObj.transform.position);
- eulq.Enqueue(cameraObj.transform.eulerAngles);
- }
- }
|