using UnityEngine; using System.Collections; public class TestMoveCure : MonoBehaviour { public GameObject t1; //开始位置 public GameObject t2; //结束位置 public float speed = 0; float mSpeed = 0; void Start() { Application.targetFrameRate = 60; } // Update is called once per frame void Update() { //两者中心点 Vector3 center = (t1.transform.position + t2.transform.position) * 0.5f; center -= new Vector3(0, 1, 0); Vector3 start = t1.transform.position - center; Vector3 end = t2.transform.position - center; //弧形插值 transform.position = Vector3.Slerp(start, end, mSpeed += Time.deltaTime * speed); transform.position += center; } }