首页 > 技术文章 > 插值转向

sanyejun 2017-11-23 21:04 原文

//控制转向---插值转向--这段代码要写在最后
//transform.LookAt(transform.position + dir.normalized);
Quaternion myRotation = Quaternion.LookRotation(dir.normalized, Vector3.up);
Quaternion newRotation = Quaternion.Lerp(transform.rotation, myRotation, rotateSpeed * Time.deltaTime);
transform.rotation = newRotation;

推荐阅读