Get it on Google Play


Wm뮤 :: 유니티 내비게이션 navigation

블로그 이미지
가끔 그림그리거나 3D모델링하거나
취미로 로봇만드는
퇴직한 전자과 게임프로그래머
2020.3.48f1 , 2022.3.6f1 주로 사용
모카쨩
@Ahzkwid

Recent Comment

Archive


2020. 10. 25. 14:18 Unity

 

 

스탠다드 에셋 방식

더보기

먼저 스탠다드 에셋을 다운받는다

 

 

unityStandardAssetNavAI.unitypackage
8.83MB

 

 

3D모델의 애니메이터가 있는 최상단에 ThirdPersonAnimatorController를 넣는다

 

AI캐릭터 컨트롤을 넣고 이동하고자 하는 지점의 트랜스폼을 넣는다

 

Third Person Character의 Ground Check Distance값을 0.2로 수정한다.

왜냐하면 기본값은 Ground Check Distance가 너무 작아서 지면판정이 안되기 때문이다

 

Window-> AI/Navigation을 누른다

 

베이크 하면 완료된다

 

커스텀 방식

더보기

 

 

AIControl 코드

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;

public class AIControl : MonoBehaviour
{

    public Transform target;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        var agent = GetComponent<NavMeshAgent>();
        if ((target != null)&& (agent != null))
        {
            agent.SetDestination(target.position);
        }
    }
}

 

저렇게 배치하고 AIControl을 넣는다

 

 

'Unity' 카테고리의 다른 글

이벤트 트리거  (0) 2020.10.29
TTS  (0) 2020.10.19
유니티 Mask  (0) 2020.09.24
posted by 모카쨩

  • total
  • today
  • yesterday

Recent Post

저사양 유저용 블로그 진입