SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

19 lines
583 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Follow : MonoBehaviour
{
[SerializeField]
private Transform target;
// Start is called before the first frame update
// Update is called once per frame
void Update()
{
Vector3 lookPos = target.position - transform.position;
Quaternion lookRot = Quaternion.LookRotation(lookPos, Vector3.up);
float eulerY = lookRot.eulerAngles.y;
Quaternion rotation = Quaternion.Euler(0, eulerY, 0);
transform.rotation = rotation;
}
}