Unity Normailized (1) 썸네일형 리스트형 Prototype4: 플레이어를 따라가는 몬스터, normalized, Time.deltaTime Monster.cs public float Speed = 3f; private Vector3 Direction; void Start() { // 플레이어 오브젝트를 들고온다 Player = GameObject.Find("Player"); } void Update() { // Player를 향하는 방향 벡터 계산 // 플레이어의 위치에서 나(=Monster)의 위치값을 뺀다. Direction = (Player.transform.position - transform.position).normalized; // 계산된 방향으로 이동한다 (이동할 방향 좌표 * 속도 * 프레임 간의 시간간격) transform.Translate(Direction * Speed * Time.deltaTime); } normali.. 이전 1 다음