728x90
Navigation
Agents
- Name : 객체의 이름
- Radius : 객체의 크기
- Height : 객체의 높이
- Step Height : 올라갈수 있는 높이
- Max Slope : 올라갈 수 있는 경사도
Bake
Agents와 비슷하지만 실제 맵에 갈 수 있는 곳 그려
Nav Mesh Obstacle
- Curve : Nav Mehs에 영향을 줄지 선택하는 것
- Carve only Stationary : 선택하면 움직일때는 Bake하지 않음. 체크할시 연산이 많이 됨
미리 받아둔 오브젝트의 위치로 가게 되는 코드
using UnityEngine;
using UnityEngine.AI;
public class ChaseNavAgent : MonoBehaviour
{
[SerializeField] private Transform _targetTrm;
private NavMeshAgent _agent;
private void Awake()
{
_agent = GetComponent<NavMeshAgent>();
}
private void Update()
{
if (Input.GetButtonDown("Jump"))
{
Vector3 pos = _targetTrm.position;
pos.y = transform.position.y;
_agent.SetDestination(pos);
}
}
}
728x90
'GGM > 엔진' 카테고리의 다른 글
20230320 - 엔진 - Combo, Rolling (0) | 2023.03.21 |
---|---|
20230315 - 엔진 - RayCast, 애니메이션 (0) | 2023.03.16 |
20230313 - 엔진 - 애니메이션, 인풋 바꿈 (1) | 2023.03.13 |
20230308 - 엔진 - 플레이어 움직이게, 쉐이더 (0) | 2023.03.08 |
20230306 - 엔진 - mesh, Materials (0) | 2023.03.06 |
댓글