标签:unity set nbsp erp 调整 tar mon void mono
1 public class FollowPlayer : MonoBehaviour 2 { 3 public Transform Player; 4 private Vector3 Offset; 5 6 void Start() 7 { 8 //设置差值 9 Offset= Player.position - transform.position; 10 } 11 12 void Update() 13 { 14 transform.position = Player.position - Offset; 15 } 16 }
public class FollowPlayer : MonoBehaviour { public Transform Player; private Vector3 Offset; private int Speed = 2; void Start() { Offset = Player.position - transform.position; } void Update() { //调整相机与玩家之间的距离 transform.position = Vector3.Lerp(transform.position, Player.position - Offset, Speed * Time.deltaTime); } }
标签:unity set nbsp erp 调整 tar mon void mono
原文地址:https://www.cnblogs.com/M-fengye/p/9528590.html