#1. player의 이동(waypoint를 순회하며 반복 이동구현) #Vector3.MoveTowards 사용 https://docs.unity3d.com/ScriptReference/Vector3.MoveTowards.html Unity - Scripting API: Vector3.MoveTowards Use the MoveTowards member to move an object at the current position toward the target position. By updating an object’s position each frame using the position calculated by this function, you can move it towards the target sm..

#캐릭터의 이동,애니매이션 구현 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Hero : MonoBehaviour { private GameObject modelGo; public enum eState { None=-1, Idle, Run, Attack } public float radius = 30; public Transform target; private Animator anim; private Vector3 dir; private eState state; private Coroutine routine; public float speed = 1f; public void Init(G..

#Vector3.Dot 두 vector의 내적. 내적은 곱한 두 벡터의 크기와 그 사이 각도의 코사인을 곱한 부동 소수점 값 https://docs.unity3d.com/ScriptReference/Vector3.Dot.html Unity - Scripting API: Vector3.Dot The dot product is a float value equal to the magnitudes of the two vectors multiplied together and then multiplied by the cosine of the angle between them. For normalized vectors Dot returns 1 if they point in exactly the same directi..

using System.Collections; using System.Collections.Generic; using UnityEngine; public class LionStandard : MonoBehaviour { void Update() { var h = Input.GetAxisRaw("Horizontal"); //x -1,0,1 var v = Input.GetAxisRaw("Vertical"); //z -1,0,1 var dir = Vector3.Normalize(new Vector3(h, 0, v)); if (dir != Vector3.zero) { var angle = Mathf.Atan2(dir.x, dir.z) * Mathf.Rad2Deg; this.transform.rotation = ..