public class Follow : MonoBehaviour {
public GameObject main;
Vector3 actuallyward = Vector3.forward;
float speed = 0.3f;
private void Update()
{//向量a
Vector3 dir = (main.transform.position - gameObject.transform.position).normalized;
actuallyward = Vector3.Lerp(actuallyward,dir,0.2f);
gameObject.transform.Translate(actuallyward * speed);
}
小怪平滑跟随角色
最新推荐文章于 2024-09-29 17:21:18 发布