求大神帮忙看看, unity球形插值问题

public Transform sunrise;
public Transform sunset;
public float journeyTime = 1.0F;
private float startTime;
void Start() {
startTime = Time.time;
}
void Update() {

    Vector3 center = (sunrise.position + sunset.position) * 0.5F;
    Debug.DrawLine (center, center+new Vector3(0, 1, 0));
    Debug.Log (center);
    center -= new Vector3(0, 1, 0);
    Debug.Log (center);
    Vector3 riseRelCenter = sunrise.position - center;
    Vector3 setRelCenter = sunset.position - center;
    float fracComplete = (Time.time - startTime) / journeyTime;
    transform.position = Vector3.Slerp(riseRelCenter, setRelCenter, fracComplete);
    transform.position += center;
}

这个代码怎么不直接插值, 非得找个中心点,跟直接进行球形插值有什么区别
查看全部
qq_37296877
qq_37296877
2017/05/18 13:42
  • unity
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

2个回复