代码如下
using UnityEngine;
using System.Collections;
public class MoveCamera : MonoBehaviour
{
public Transform targetPoint;
int Xuanzhuan = 30;
// Update is called once per frame
void Update()
{
// 移动camera到指定的地点
transform.position = Vector3.MoveTowards(transform.position, targetPoint.position, 3 * Time.deltaTime);
Xuanzhuan = Mathf.Clamp(Xuanzhuan,-60,60);
transform.Rotate(Vector3.up * Time.deltaTime * -Xuanzhuan);
}
}
using UnityEngine;
using System.Collections;
public class MoveCamera : MonoBehaviour
{
public Transform targetPoint;
int Xuanzhuan = 30;
// Update is called once per frame
void Update()
{
// 移动camera到指定的地点
transform.position = Vector3.MoveTowards(transform.position, targetPoint.position, 3 * Time.deltaTime);
Xuanzhuan = Mathf.Clamp(Xuanzhuan,-60,60);
transform.Rotate(Vector3.up * Time.deltaTime * -Xuanzhuan);
}
}