这里给主相机绑定一个脚本. 脚本写为: using UnityEngine; using System.Collections; public class camerafollow : MonoBehaviour { //主摄像机跟随主角一起移动 public float xMargin = 1f; public float yMargin = 1f; public float xSmooth = 8f; public float ySmooth = 8f; public Vector2 max…
固定相机跟随 这种相机有一个参考对象,它会保持与该参考对象固定的位置,跟随改参考对象发生移动 using UnityEngine; using System.Collections; public class CameraFlow : MonoBehaviour { public Transform target; private Vector3 offset; // Use this for initialization void Start() { offset = target.posit…